{"record":{"id":"d98d9f021394b081","repo":"eyaltoledano/claude-task-master","slug":"subtask-subtaskid-not-found-in-parent-task-pa-d98d9f","errorCode":null,"errorMessage":"Subtask ${subtaskId} not found in parent task ${parentId}","messagePattern":"Subtask (.+?) not found in parent task (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/modules/task-manager/update-single-task-status.js","lineNumber":46,"sourceCode":"\tif (taskIdInput.includes('.')) {\n\t\tconst [parentId, subtaskId] = taskIdInput\n\t\t\t.split('.')\n\t\t\t.map((id) => parseInt(id, 10));\n\n\t\t// Find the parent task\n\t\tconst parentTask = data.tasks.find((t) => t.id === parentId);\n\t\tif (!parentTask) {\n\t\t\tthrow new Error(`Parent task ${parentId} not found`);\n\t\t}\n\n\t\t// Find the subtask\n\t\tif (!parentTask.subtasks) {\n\t\t\tthrow new Error(`Parent task ${parentId} has no subtasks`);\n\t\t}\n\n\t\tconst subtask = parentTask.subtasks.find((st) => st.id === subtaskId);\n\t\tif (!subtask) {\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\t// Update the subtask status\n\t\tconst oldStatus = subtask.status || 'pending';\n\t\tsubtask.status = newStatus;\n\n\t\tlog(\n\t\t\t'info',\n\t\t\t`Updated subtask ${parentId}.${subtaskId} status from '${oldStatus}' to '${newStatus}'`\n\t\t);\n\n\t\t// Check if all subtasks are done (if setting to 'done')\n\t\tif (\n\t\t\tnewStatus.toLowerCase() === 'done' ||\n\t\t\tnewStatus.toLowerCase() === 'completed'\n\t\t) {","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/update-single-task-status.js#L28-L64","documentation":"updateSingleTaskStatus looks up the subtask by numeric ID within the parent task's subtasks array and throws when no subtask with that ID exists. It is thrown after confirming the parent task exists and has subtasks, so it specifically means the subtask ID itself does not match any entry.","triggerScenarios":"Calling setTaskStatus (or updateSingleTaskStatus) with an ID like '5.2' where parent 5 exists and has subtasks, but no subtask with id 2; or passing a subtask ID that was already deleted.","commonSituations":"Stale IDs from an old task list, off-by-one mistakes assuming subtasks are 0-indexed (they are 1-indexed by default), or querying a different tag where the parent's subtasks differ.","solutions":["Run 'task-master list' or read tasks.json to confirm the subtask ID exists under the parent","Verify you are operating on the correct tag/context (subtasks differ per tag)","Re-check that the ID is parentId.subtaskId and the subtask part matches an existing subtask id"],"exampleFix":"// before\nawait setTaskStatus('5.3', 'done', tasksPath);\n// after\nconst parent = data.tasks.find(t => t.id === 5);\nif (!parent?.subtasks?.some(s => s.id === 3)) {\n  throw new Error('Subtask 5.3 does not exist; check list output first');\n}\nawait setTaskStatus('5.3', 'done', tasksPath);","handlingStrategy":"validation","validationCode":"const [pid, sid] = String(id).split('.').map(Number);\nconst parent = data.tasks.find(t => t.id === pid);\nif (!parent?.subtasks?.some(s => s.id === sid)) {\n  throw new Error(`Subtask ${id} does not exist; check task-master list`);\n}","typeGuard":"function subtaskExists(tasks, id) {\n  const [p, s] = String(id).split('.').map(Number);\n  return tasks.some(t => t.id === p && Array.isArray(t.subtasks) && t.subtasks.some(st => st.id === s));\n}","tryCatchPattern":"try {\n  await setTaskStatus(id, 'done', tasksPath);\n} catch (err) {\n  if (String(err.message).includes('not found in parent task')) {\n    console.error(`Subtask ${id} missing — verify with task-master list`);\n  } else throw err;\n}","preventionTips":["Always list tasks/subtasks before referencing IDs","Remember subtask IDs are parentId.subtaskId, 1-indexed subtasks","Re-derive IDs after any task deletion or reorganization"],"tags":["lookup-failure","task-management"],"backgroundTag":"task-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}