{"record":{"id":"a688bdf4c0827429","repo":"eyaltoledano/claude-task-master","slug":"task-not-found-a688bd","errorCode":"TASK_NOT_FOUND","errorMessage":"Source task with ID ${sourceTaskId} not found","messagePattern":"Source task with ID (.+?) not found","errorType":"exception","errorClass":"MoveTaskError","httpStatus":null,"severity":"error","filePath":"scripts/modules/task-manager/move-task.js","lineNumber":387,"sourceCode":"\treturn {\n\t\tmessage: `Converted subtask ${sourceId} to task ${destinationId}`,\n\t\tmovedItem: newTask\n\t};\n}\n\nfunction moveTaskToSubtask(tasks, sourceId, destinationId) {\n\t// Parse IDs\n\tconst sourceTaskId = parseInt(sourceId, 10);\n\tconst [destParentId, destSubtaskId] = destinationId\n\t\t.split('.')\n\t\t.map((id) => parseInt(id, 10));\n\n\t// Find source task and destination parent\n\tconst sourceTaskIndex = tasks.findIndex((t) => t.id === sourceTaskId);\n\tconst destParentTask = tasks.find((t) => t.id === destParentId);\n\n\tif (sourceTaskIndex === -1) {\n\t\tthrow new MoveTaskError(\n\t\t\tMOVE_ERROR_CODES.TASK_NOT_FOUND,\n\t\t\t`Source task with ID ${sourceTaskId} not found`\n\t\t);\n\t}\n\tif (!destParentTask) {\n\t\tthrow new MoveTaskError(\n\t\t\tMOVE_ERROR_CODES.PARENT_TASK_NOT_FOUND,\n\t\t\t`Destination parent task with ID ${destParentId} not found`\n\t\t);\n\t}\n\n\tconst sourceTask = tasks[sourceTaskIndex];\n\n\t// Initialize subtasks array if it doesn't exist (based on commit fixes)\n\tif (!destParentTask.subtasks) {\n\t\tdestParentTask.subtasks = [];\n\t}\n","sourceCodeStart":369,"sourceCodeEnd":405,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/move-task.js#L369-L405","documentation":"This MoveTaskError with code TASK_NOT_FOUND is thrown by moveTaskToSubtask when the source task ID to be converted into a subtask does not exist in the tasks array. moveTaskToSubtask looks up tasks.findIndex(t => t.id === sourceTaskId) and throws immediately if the index is -1. It prevents proceeding with a move that would otherwise silently do nothing.","triggerScenarios":"Calling moveTask with a plain numeric source ID (not a subtask form) and a subtask destination (parentId.subtaskId), where the source ID has been deleted, was never created, or is mistyped (e.g. '12' when only tasks 1-10 exist).","commonSituations":"Typo in task ID on the CLI; task was deleted in another session/tag context so the local file no longer has it; hardcoded IDs in automation scripts after the task list changed; confusing subtask IDs (5.2) with top-level IDs.","solutions":["Verify the source ID exists: `tasks.some(t => t.id === sourceTaskId)` before calling moveTask.","List tasks to confirm the correct ID, then retry with the right one.","Check you are operating on the correct tag context; the task may exist under a different tag.","If the ID is a subtask (e.g. 5.2), ensure the move path used supports subtask sources rather than task-to-subtask.","Correct stale scripts/configs that reference deleted task IDs."],"exampleFix":"// before\nmoveTask(tasksPath, '12', '3.1'); // task 12 doesn't exist\n// after\nconst tasks = readJSON(tasksPath);\nif (tasks.some(t => t.id === 12)) {\n  moveTask(tasksPath, '12', '3.1');\n} else {\n  console.error('Task 12 not found; check `task-master list`.');\n}","handlingStrategy":"validation","validationCode":"const data = JSON.parse(fs.readFileSync(tasksPath, 'utf8'));\nconst pool = [...(data.master?.tasks ?? [])];\nif (!pool.some(t => t.id === Number(sourceTaskId))) {\n  throw new Error(`Source task ${sourceTaskId} not found in current tag.`);\n}","typeGuard":"function taskExists(tasks, id) {\n  return tasks.findIndex(t => t.id === Number(id)) !== -1;\n}","tryCatchPattern":"try {\n  await moveTask(tasksPath, sourceId, '3.1');\n} catch (e) {\n  if (e.code === 'TASK_NOT_FOUND') {\n    console.error(`No task ${sourceId}; run the list command to get valid IDs.`);\n  } else throw e;\n}","preventionTips":["Copy task IDs directly from the list output rather than typing from memory.","Remember IDs are tag-scoped; confirm the active tag before moving.","Re-fetch the task list before automation steps that reference IDs.","Don't pass subtask IDs (5.2) into task-to-subtask moves expecting task semantics."],"tags":["task-management","not-found","move-task"],"backgroundTag":"task-id-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}