{"record":{"id":"a964337fc3279cc0","repo":"eyaltoledano/claude-task-master","slug":"subtask-not-found-a96433","errorCode":"SUBTASK_NOT_FOUND","errorMessage":"Subtask ${id} or its parent task not found.","messagePattern":"Subtask (.+?) or its parent task not found\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mcp-server/src/core/direct-functions/update-subtask-by-id.js","lineNumber":115,"sourceCode":"\t\t\t\tuseResearch,\n\t\t\t\t{\n\t\t\t\t\tmcpLog: logWrapper,\n\t\t\t\t\tsession,\n\t\t\t\t\tprojectRoot,\n\t\t\t\t\ttag,\n\t\t\t\t\tcommandName: 'update-subtask',\n\t\t\t\t\toutputType: 'mcp',\n\t\t\t\t\tmetadata\n\t\t\t\t},\n\t\t\t\t'json'\n\t\t\t);\n\n\t\t\tif (!coreResult || coreResult.updatedSubtask === null) {\n\t\t\t\tconst message = `Subtask ${id} or its parent task not found.`;\n\t\t\t\tlogWrapper.error(message);\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: { code: 'SUBTASK_NOT_FOUND', message: message }\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst parentId = subtaskIdStr.split('.')[0];\n\t\t\tconst successMessage = `Successfully updated subtask with ID ${subtaskIdStr}`;\n\t\t\tlogWrapper.success(successMessage);\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tdata: {\n\t\t\t\t\tmessage: `Successfully updated subtask with ID ${subtaskIdStr}`,\n\t\t\t\t\tsubtaskId: subtaskIdStr,\n\t\t\t\t\tparentId: parentId,\n\t\t\t\t\tsubtask: coreResult.updatedSubtask,\n\t\t\t\t\ttasksPath,\n\t\t\t\t\tuseResearch,\n\t\t\t\t\ttelemetryData: coreResult.telemetryData,\n\t\t\t\t\ttagInfo: coreResult.tagInfo\n\t\t\t\t}","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/update-subtask-by-id.js#L97-L133","documentation":"After delegating to the core update logic, updateSubtaskByIdDirect checks the result: if no coreResult comes back or coreResult.updatedSubtask is null, the requested subtask (or its parent task) does not exist in storage and it returns SUBTASK_NOT_FOUND. This is a lookup failure, not an input-format problem — the ID was well-formed but matched nothing.","triggerScenarios":"Requesting subtask '5.2' when task 5 has no second subtask, the parent task was deleted, the ID references a different tasks.json/project, or API storage where the ticket ID does not exist.","commonSituations":"Stale IDs after re-generating tasks (IDs shifted), pointing tasksJsonPath at another project's tasks file, typos in the parent portion of a dotted ID ('55.2' vs '5.2').","solutions":["List tasks (get-tasks tool) to confirm the parent task and subtask index still exist.","Verify tasksJsonPath points at the correct project's tasks file.","Re-derive the subtask ID from current task data rather than a cached/older reference.","For API storage, confirm the ticket ID (e.g. HAM-2611) exists in the remote system."],"exampleFix":"// before\nawait updateSubtask({ id: '5.2', prompt: 'x', tasksJsonPath }); // subtask gone\n// after\nconst tasks = await getTasks({ tasksJsonPath }); // verify 5.2 exists first\nawait updateSubtask({ id: '5.2', prompt: 'x', tasksJsonPath });","handlingStrategy":"validation","validationCode":"const tasks = JSON.parse(fs.readFileSync(tasksJsonPath, 'utf8')).tasks;\nconst [pid, sid] = id.split('.').map(Number);\nconst parent = tasks.find(t => t.id === pid);\nif (!parent || !parent.subtasks || !parent.subtasks.some(s => s.id === sid)) {\n  throw new Error(`Subtask ${id} not found — refresh task list first`);\n}","typeGuard":"function subtaskExists(tasks, id) {\n  const [p, s] = id.split('.').map(Number);\n  const parent = tasks.find(t => t.id === p);\n  return Boolean(parent && parent.subtasks?.some(x => x.id === s));\n}","tryCatchPattern":"const res = await updateSubtaskByIdDirect(args);\nif (!res.success && res.error.code === 'SUBTASK_NOT_FOUND') {\n  const tasks = await getTasks({ tasksJsonPath: args.tasksJsonPath }); // re-sync IDs\n}","preventionTips":["Re-fetch the task list after any operation that can renumber tasks","Never cache subtask IDs across taskmaster regenerate/expands","Confirm tasksJsonPath points to the same project the ID came from"],"tags":["mcp","not-found","lookup"],"backgroundTag":"resource-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}