{"record":{"id":"6fc7989771c4ae2b","repo":"eyaltoledano/claude-task-master","slug":"subtask-not-found","errorCode":"SUBTASK_NOT_FOUND","errorMessage":"Source subtask ${sourceId} not found","messagePattern":"Source subtask (.+?) not found","errorType":"exception","errorClass":"MoveTaskError","httpStatus":null,"severity":"error","filePath":"scripts/modules/task-manager/move-task.js","lineNumber":250,"sourceCode":"\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}\n\n\t// Find source subtask\n\tconst sourceSubtaskIndex = sourceParentTask.subtasks.findIndex(\n\t\t(st) => st.id === sourceSubtaskId\n\t);\n\tif (sourceSubtaskIndex === -1) {\n\t\tthrow new MoveTaskError(\n\t\t\tMOVE_ERROR_CODES.SUBTASK_NOT_FOUND,\n\t\t\t`Source subtask ${sourceId} not found`\n\t\t);\n\t}\n\n\tconst sourceSubtask = sourceParentTask.subtasks[sourceSubtaskIndex];\n\n\tif (sourceParentId === destParentId) {\n\t\t// Moving within the same parent\n\t\tif (destParentTask.subtasks.length > 0) {\n\t\t\tconst destSubtaskIndex = destParentTask.subtasks.findIndex(\n\t\t\t\t(st) => st.id === destSubtaskId\n\t\t\t);\n\t\t\tif (destSubtaskIndex !== -1) {\n\t\t\t\t// Remove from old position\n\t\t\t\tsourceParentTask.subtasks.splice(sourceSubtaskIndex, 1);\n\t\t\t\t// Insert at new position (adjust index if moving within same array)\n\t\t\t\tconst adjustedIndex =","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/move-task.js#L232-L268","documentation":"After finding the source parent, moveSubtaskToSubtask searches parent.subtasks for the subtask ID given in 'X.Y'. If the subtask is absent from the parent's subtasks array, it throws MoveTaskError with code SUBTASK_NOT_FOUND (message interpolates the full sourceId like '5.2').","triggerScenarios":"Calling moveTask('5.3', '7.1') where task 5 exists but has no subtask with id 3; subtask was already moved/deleted; using a 1-based vs 0-based ID confusion (subtask IDs are stored as given, typically 1-based).","commonSituations":"Stale local tasks.json after a teammate moved the subtask; typo in the subtask ordinal; assuming subtasks auto-exist; hand-edited tasks.json where the subtasks array lost the entry.","solutions":["Run `task-master show <parentId>` to list the parent's actual subtask IDs and correct the ordinal","Re-pull/sync tasks.json if another process modified it","Remove empty parts of the source string (e.g. '5.' or '5,5.2' malformed entries) — parsing can yield NaN that matches nothing","If the subtask was already moved, the operation is a no-op; skip it"],"exampleFix":"// before (task 5 has subtasks 1 and 2 only)\ntask-master move --from=5.3 --to=7.1\n// after\ntask-master show 5   # subtasks: 5.1, 5.2\ntask-master move --from=5.2 --to=7.1","handlingStrategy":"validation","validationCode":"function assertSourceSubtask(tasks, sourceId) {\n  const [p, s] = String(sourceId).split('.').map((n) => parseInt(n, 10));\n  const parent = tasks.find((t) => t.id === p);\n  if (!parent?.subtasks?.some((st) => st.id === s)) {\n    throw new Error(`Subtask ${sourceId} not found on parent ${p}`);\n  }\n}","typeGuard":"const subtaskExists = (tasks, sourceId) => {\n  const [p, s] = sourceId.split('.').map(Number);\n  return tasks.find((t) => t.id === p)?.subtasks?.some((st) => st.id === s) ?? false;\n};","tryCatchPattern":"try {\n  await moveTask(tasksPath, '5.2', '7.1', false, { projectRoot, tag });\n} catch (err) {\n  if (err.name === 'MoveTaskError' && err.code === 'SUBTASK_NOT_FOUND') {\n    console.error('Check `task-master show 5` for the actual subtask IDs');\n  } else throw err;\n}","preventionTips":["Inspect the parent's subtasks with `task-master show <parentId>` before moving","Don't reuse stale ID lists after any prior move — subtask IDs change location, not the operations' idempotency","Sync tasks.json before scripted multi-step moves","Guard with parent.subtasks.some(s => s.id === n) in automation"],"tags":["task-move","not-found","subtask"],"backgroundTag":"subtask-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}