{"record":{"id":"a4d8a40a5f458e4d","repo":"eyaltoledano/claude-task-master","slug":"parent-task-not-found","errorCode":"PARENT_TASK_NOT_FOUND","errorMessage":"Source parent task with ID ${sourceParentId} not found","messagePattern":"Source parent task with ID (.+?) not found","errorType":"error_code","errorClass":"MoveTaskError","httpStatus":null,"severity":"error","filePath":"scripts/modules/task-manager/move-task.js","lineNumber":225,"sourceCode":"\treturn result;\n}\n\n// Helper functions for different move scenarios\nfunction moveSubtaskToSubtask(tasks, sourceId, destinationId) {\n\t// Parse IDs\n\tconst [sourceParentId, sourceSubtaskId] = sourceId\n\t\t.split('.')\n\t\t.map((id) => parseInt(id, 10));\n\tconst [destParentId, destSubtaskId] = destinationId\n\t\t.split('.')\n\t\t.map((id) => parseInt(id, 10));\n\n\t// Find source and destination parent tasks\n\tconst sourceParentTask = tasks.find((t) => t.id === sourceParentId);\n\tconst destParentTask = tasks.find((t) => t.id === destParentId);\n\n\tif (!sourceParentTask) {\n\t\tthrow new MoveTaskError(\n\t\t\tMOVE_ERROR_CODES.PARENT_TASK_NOT_FOUND,\n\t\t\t`Source parent task with ID ${sourceParentId} 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\t// Initialize subtasks arrays if they don't exist (based on commit fixes)\n\tif (!sourceParentTask.subtasks) {\n\t\tsourceParentTask.subtasks = [];\n\t}\n\tif (!destParentTask.subtasks) {\n\t\tdestParentTask.subtasks = [];\n\t}","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/move-task.js#L207-L243","documentation":"moveSubtaskToSubtask moves subtask 'X.Y' under destination 'P.Q' by locating both parent tasks (X and P) in the current tag's tasks array. If the source parent task X cannot be found, it throws MoveTaskError with code PARENT_TASK_NOT_FOUND.","triggerScenarios":"Calling moveTask('5.2', '7.3') where no task with id === parseInt('5') exists in the tag's tasks array — the source parent ID is nonexistent, was already moved to another tag, or the ID was mistyped.","commonSituations":"Referencing a task in the wrong tag (task 5 exists in 'backlog' but not the active tag); task deleted before the move; using a full task ID string where a parent numeric ID is expected.","solutions":["Verify the source task exists in the current tag with `task-master list` before moving","If the task lives in another tag, pass --tag with the correct tag or move cross-tag first","Check the source ID format: '5.2' means parent 5, subtask 2 — parent 5 must exist","Re-read tasks.json to confirm the parent task's numeric id (IDs are stored as numbers)"],"exampleFix":"// before (task 12 doesn't exist in this tag)\ntask-master move --from=12.1 --to=7.3\n// after\ntask-master list  # confirm task exists, then:\ntask-master move --from=5.1 --to=7.3","handlingStrategy":"validation","validationCode":"function assertSourceParent(tasks, sourceId) {\n  const parentId = parseInt(String(sourceId).split('.')[0], 10);\n  if (!tasks.some((t) => t.id === parentId)) {\n    throw new Error(`Source parent task ${parentId} not found in current tag`);\n  }\n}","typeGuard":"const parentExists = (tasks, id) =>\n  Number.isFinite(id) && tasks.some((t) => t.id === id);","tryCatchPattern":"try {\n  await moveTask(tasksPath, '5.2', '7.3', false, { projectRoot, tag });\n} catch (err) {\n  if (err.name === 'MoveTaskError' && err.code === 'PARENT_TASK_NOT_FOUND' && /Source parent/.test(err.message)) {\n    console.error('Source parent missing — check `task-master list` and the active --tag');\n  } else throw err;\n}","preventionTips":["Run `task-master list` in the target tag before scripted moves","Remember the parent part of 'X.Y' must be an existing task in the SAME tag","Refresh tasks.json after teammates or other tools move/delete tasks","Validate parent existence with a read before batch operations"],"tags":["task-move","not-found","subtask","validation"],"backgroundTag":"parent-task-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}