{"record":{"id":"4db667b1530e4f25","repo":"eyaltoledano/claude-task-master","slug":"task-taskid-not-found","errorCode":null,"errorMessage":"Task ${taskId} not found","messagePattern":"Task (.+?) not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/storage/adapters/api-storage.ts","lineNumber":687,"sourceCode":"\t/**\n\t * Update task or subtask status by ID - for API storage\n\t */\n\tasync updateTaskStatus(\n\t\ttaskId: string,\n\t\tnewStatus: TaskStatus,\n\t\ttag?: string\n\t): Promise<UpdateStatusResult> {\n\t\tawait this.ensureInitialized();\n\n\t\ttry {\n\t\t\tAuthManager.getInstance().ensureBriefSelected('updateTaskStatus');\n\n\t\t\tconst existingTask = await this.retryOperation(() =>\n\t\t\t\tthis.repository.getTask(this.projectId, taskId)\n\t\t\t);\n\n\t\t\tif (!existingTask) {\n\t\t\t\tthrow new Error(`Task ${taskId} not found`);\n\t\t\t}\n\n\t\t\tconst oldStatus = existingTask.status;\n\t\t\tif (oldStatus === newStatus) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\toldStatus,\n\t\t\t\t\tnewStatus,\n\t\t\t\t\ttaskId\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Update the task/subtask status\n\t\t\tawait this.retryOperation(() =>\n\t\t\t\tthis.repository.updateTask(this.projectId, taskId, {\n\t\t\t\t\tstatus: newStatus,\n\t\t\t\t\tupdatedAt: new Date().toISOString()\n\t\t\t\t})","sourceCodeStart":669,"sourceCodeEnd":705,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/storage/adapters/api-storage.ts#L669-L705","documentation":"updateTaskStatus throws a plain Error `Task ${taskId} not found` when repository.getTask returns null/undefined for the given id. This plain Error is then caught by the method's catch and re-wrapped via wrapError as a STORAGE_ERROR TaskMasterError. It signals the task or subtask ID does not exist in the selected brief on the backend.","triggerScenarios":"Calling updateTaskStatus with an id that was deleted, belongs to a different brief/tag, is a malformed subtask id (e.g. wrong '1.2' resolution), or exists only locally and was never pushed to the API.","commonSituations":"Stale local task list after another session/machine deleted the task; switching briefs and using ids from the old brief; typo in task id; subtask numbering shifted after a server-side change.","solutions":["Fetch the current task list (getTask/listTasks) and confirm the id exists in the selected brief","Verify the correct brief/tag is selected before resolving ids","Check subtask id format (e.g. '1.2') matches the backend's current numbering","Handle the not-found case gracefully in scripts: treat as no-op or re-sync ids"],"exampleFix":"// before\nawait storage.updateTaskStatus('5', 'done');\n// after\nconst task = await storage.getTask('5');\nif (!task) throw new Error('Re-sync task list; task 5 not in current brief');\nawait storage.updateTaskStatus('5', 'done');","handlingStrategy":"validation","validationCode":"const task = await storage.getTask(taskId);\nif (!task) throw new Error(`Task ${taskId} does not exist in the current brief; re-sync ids`);\nconst VALID = ['pending','in-progress','done','cancelled','deferred'];\nif (!VALID.includes(newStatus)) throw new Error(`Invalid status: ${newStatus}`);","typeGuard":"function isTask(t: unknown): t is Task {\n  return typeof t === 'object' && t !== null && typeof (t as Task).id === 'string';\n}","tryCatchPattern":"try {\n  await storage.updateTaskStatus(taskId, 'done', tag);\n} catch (e) {\n  if (/not found/.test(e.message)) {\n    console.warn(`Task ${taskId} not in brief; skipping`);\n    return;\n  }\n  throw e;\n}","preventionTips":["Resolve ids from a freshly fetched task list, not a stale cache","Ensure the correct brief is selected before using ids","Validate subtask id formats ('1.2') against the backend layout","Guard scripts against ids deleted in other sessions"],"tags":["storage","api","task-not-found","status"],"backgroundTag":"task-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}