{"record":{"id":"6667c22f6be7991d","repo":"AlistGo/alist","slug":"task-not-found","errorCode":null,"errorMessage":"task not found","messagePattern":"task not found","errorType":"exception","errorClass":"ErrTaskNotFound","httpStatus":null,"severity":"warning","filePath":"pkg/task/errors.go","lineNumber":6,"sourceCode":"package task\n\nimport \"errors\"\n\nvar (\n\tErrTaskNotFound = errors.New(\"task not found\")\n\tErrTaskRunning  = errors.New(\"task is running\")\n)\n","sourceCodeStart":1,"sourceCodeEnd":9,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/pkg/task/errors.go#L1-L9","documentation":"ErrTaskNotFound from the task manager (pkg/task/manager.go): Retry, Cancel, or Remove was called with a task ID that is not present in the manager's in-memory task map (returned wrapped with errors.WithStack).","triggerScenarios":"Calling Manager.Retry(tid)/Cancel(tid)/Remove(tid) for a task that was never submitted, was already removed, or belongs to a different Manager instance (tasks are not persisted).","commonSituations":"UI holds a stale task list after an alist restart (task registry is memory-only and empty), calling retry/cancel after ClearDone removed the task, or using an ID from a different task type's manager (copy vs. upload managers are separate).","solutions":["Check existence first with Manager.Get(tid) and refresh the task list before acting","After an alist restart, resubmit work instead of retrying old task IDs — tasks do not survive restarts","Make sure you call the correct manager instance for the task kind"],"exampleFix":"// before\nerr := taskManager.Retry(id)\n\n// after\nif _, ok := taskManager.Get(id); !ok {\n    // refresh task list; task gone (restart or cleared)\n    tasks = taskManager.GetAll()\n    return nil\n}\nerr := taskManager.Retry(id)","handlingStrategy":"validation","validationCode":"if _, ok := taskManager.Get(tid); !ok {\n\treturn errors.New(\"task not present; refresh the task list\")\n}","typeGuard":null,"tryCatchPattern":"err := taskManager.Cancel(tid)\nif errors.Is(err, task.ErrTaskNotFound) {\n\t// treat as already-finished; refresh UI state\n\treturn nil\n}","preventionTips":["Refresh the task list after restarts — tasks are memory-only","Always Get before Retry/Cancel/Remove"],"tags":["task","task-manager","state","recovery"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}