multica-ai/multica · error · ErrTaskNoLongerQueued

task is no longer queued

Error message

task is no longer queued

What it means

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.

Solutions

  1. The task has already been dequeued or started; refresh its status before retrying.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at server/internal/service/task.go:2291 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/07b2ca4f0cc5e618. Report an issue: GitHub.

Appendix: source

Thrown at server/internal/service/task.go:2291

}

type CancelledChatMessageResult struct {
	ChatSessionID  string
	MessageID      string
	Content        string
	RestoreToInput bool
	// Attachments are the rows detached from the deleted user message so they
	// survive the ON DELETE CASCADE and can re-bind when the restored draft is
	// re-sent.
	Attachments []db.Attachment
}

type CancelTaskResult struct {
	Task                 db.AgentTaskQueue
	CancelledChatMessage *CancelledChatMessageResult
}

var ErrTaskNoLongerQueued = errors.New("task is no longer queued")

// CancelTaskOptions carries what the caller knows about the client that asked
// for the cancellation.
type CancelTaskOptions struct {
	// ClientSupportsDraftRestore is true when the caller can recover a prompt
	// through the durable draft-restore path (#5219). Only such a client may be
	// handed a deferred outcome; for anyone else the empty-transcript judgment
	// stays synchronous, because the cancel response is their only chance to get
	// the prompt back. See protocol.AppCapabilityChatDraftRestoreV1.
	ClientSupportsDraftRestore bool
	// QueuedOnly turns queue edit/remove into a session-scoped compare-and-set.
	QueuedOnly          bool
	ExpectedChatSession pgtype.UUID
	QueueAction         string
	// ErrorMessage / FailureReason, when set, are persisted onto the cancelled
	// row. Only for cancellations the USER did not ask for (e.g. the worktree
	// claim gate refusing a too-old daemon): a user-initiated cancel needs no
	// explanation, but a server-initiated one without a persisted reason

View on GitHub (pinned to 2c0912b6ec)