{"record":{"id":"07b2ca4f0cc5e618","repo":"multica-ai/multica","slug":"task-is-no-longer-queued","errorCode":null,"errorMessage":"task is no longer queued","messagePattern":"task is no longer queued","errorType":"http","errorClass":"ErrTaskNoLongerQueued","httpStatus":409,"severity":"error","filePath":"server/internal/service/task.go","lineNumber":2291,"sourceCode":"}\n\ntype CancelledChatMessageResult struct {\n\tChatSessionID  string\n\tMessageID      string\n\tContent        string\n\tRestoreToInput bool\n\t// Attachments are the rows detached from the deleted user message so they\n\t// survive the ON DELETE CASCADE and can re-bind when the restored draft is\n\t// re-sent.\n\tAttachments []db.Attachment\n}\n\ntype CancelTaskResult struct {\n\tTask                 db.AgentTaskQueue\n\tCancelledChatMessage *CancelledChatMessageResult\n}\n\nvar ErrTaskNoLongerQueued = errors.New(\"task is no longer queued\")\n\n// CancelTaskOptions carries what the caller knows about the client that asked\n// for the cancellation.\ntype CancelTaskOptions struct {\n\t// ClientSupportsDraftRestore is true when the caller can recover a prompt\n\t// through the durable draft-restore path (#5219). Only such a client may be\n\t// handed a deferred outcome; for anyone else the empty-transcript judgment\n\t// stays synchronous, because the cancel response is their only chance to get\n\t// the prompt back. See protocol.AppCapabilityChatDraftRestoreV1.\n\tClientSupportsDraftRestore bool\n\t// QueuedOnly turns queue edit/remove into a session-scoped compare-and-set.\n\tQueuedOnly          bool\n\tExpectedChatSession pgtype.UUID\n\tQueueAction         string\n\t// ErrorMessage / FailureReason, when set, are persisted onto the cancelled\n\t// row. Only for cancellations the USER did not ask for (e.g. the worktree\n\t// claim gate refusing a too-old daemon): a user-initiated cancel needs no\n\t// explanation, but a server-initiated one without a persisted reason","sourceCodeStart":2273,"sourceCodeEnd":2309,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/service/task.go#L2273-L2309","documentation":"Sentinel guard in the task-queue service: CancelTask found the queued task row but it transitioned out of the queued state before the cancel could be applied (it may have started running, finished, or been cancelled by another request). The text is a stable sentinel so callers can match with errors.Is and treat the cancel as a lost race rather than a hard failure.","triggerScenarios":"Thrown at server/internal/service/task.go:2291 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The task has already been dequeued or started; refresh its status before retrying."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}