{"record":{"id":"76914118eeb14eb0","repo":"eyaltoledano/claude-task-master","slug":"subtask-subtaskid-not-found-in-parent-task-pa","errorCode":null,"errorMessage":"Subtask ${subtaskId} not found in parent task ${parentId}","messagePattern":"Subtask (.+?) not found in parent task (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/storage/adapters/file-storage/file-storage.ts","lineNumber":539,"sourceCode":"\n\t\t// Find the parent task\n\t\tconst parentTaskIndex = tasks.findIndex(\n\t\t\t(t) => String(t.id) === String(parentId)\n\t\t);\n\n\t\tif (parentTaskIndex === -1) {\n\t\t\tthrow new Error(`Parent task ${parentId} not found`);\n\t\t}\n\n\t\tconst parentTask = tasks[parentTaskIndex];\n\n\t\t// Find the subtask within the parent task\n\t\tconst subtaskIndex = parentTask.subtasks.findIndex(\n\t\t\t(st) => st.id === subtaskNumericId || String(st.id) === subId\n\t\t);\n\n\t\tif (subtaskIndex === -1) {\n\t\t\tthrow new Error(\n\t\t\t\t`Subtask ${subtaskId} not found in parent task ${parentId}`\n\t\t\t);\n\t\t}\n\n\t\tconst oldStatus = parentTask.subtasks[subtaskIndex].status || 'pending';\n\t\tif (oldStatus === newStatus) {\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\toldStatus,\n\t\t\t\tnewStatus,\n\t\t\t\ttaskId: subtaskId\n\t\t\t};\n\t\t}\n\n\t\tconst now = new Date().toISOString();\n\n\t\t// Update the subtask status\n\t\tparentTask.subtasks[subtaskIndex] = {","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/storage/adapters/file-storage/file-storage.ts#L521-L557","documentation":"After the parent task is located, updateSubtaskStatusInFile searches parentTask.subtasks for a subtask whose id matches the numeric portion after the dot. If no subtask matches, this error is thrown. The parent exists but the specific subtask does not, so the write is aborted.","triggerScenarios":"updateTaskStatus('5.9', 'done') where task 5 exists but has no subtask 9; using a stale subtask number after subtasks were renumbered or removed; passing the full subtask object id when only the numeric part is expected; subtask stored under a different parent.","commonSituations":"Automation referencing subtasks deleted during cleanup; tasks.json edited by hand dropping subtasks; migration between tags where subtask numbering differs; typos in the subtask portion of the dotted ID.","solutions":["Load the parent task and inspect its subtasks array to confirm the subtask ID before updating.","Verify the dotted ID is correct: parentId.subtaskId with a positive integer subtask number.","Check the subtask is not under a different parent or a different tag.","Re-create the subtask if it was deleted and the status update is still needed."],"exampleFix":"// before\nawait storage.updateTaskStatus('5.9', 'done');\n// after\nconst tasks = await storage.getTasks(tag);\nconst parent = tasks.find((t) => String(t.id) === '5');\nif (!parent?.subtasks?.some((s) => String(s.id) === '9')) {\n  throw new Error('Subtask 5.9 does not exist');\n}\nawait storage.updateTaskStatus('5.9', 'done', tag);","handlingStrategy":"validation","validationCode":"const tasks = await storage.getTasks(tag);\nconst [pid, sid] = subtaskId.split('.');\nconst parent = tasks.find((t) => String(t.id) === pid);\nif (!parent?.subtasks?.some((s) => String(s.id) === sid)) {\n  throw new Error(`Subtask ${subtaskId} does not exist`);\n}","typeGuard":"function findSubtask(parent: Task, subId: string): Subtask | undefined {\n  return parent.subtasks?.find((s) => String(s.id) === subId.trim());\n}","tryCatchPattern":"try {\n  await storage.updateTaskStatus('5.2', 'done', tag);\n} catch (err) {\n  if (err instanceof Error && /Subtask .* not found in parent/.test(err.message)) {\n    console.warn('Subtask missing; refreshing task list');\n    return;\n  }\n  throw err;\n}","preventionTips":["Read subtask numbers from the parent's subtasks array rather than hardcoding them.","Re-fetch tasks after any operation that can renumber or remove subtasks.","Confirm both halves of the dotted ID before calling status updates.","Watch for tag switches between listing and updating subtasks."],"tags":["task-management","file-storage","not-found","subtask"],"backgroundTag":"task-id-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}