        logger.log(.verbose, jobId: name, message: "Job has not been scheduled due to \(error.localizedDescription)")
        lock.synchronized {
            lastError = error
        }
        // Need to be called manually since the task is actually not in the queue. So cannot call cancel()
        handler.onRemove(result: .fail(error))
        listener?.onTerminated(job: info, result: .fail(error))
    }

    public func run() {
        if isCancelled && !isFinished {
            isFinished = true
        }
        if isFinished {