{"record":{"id":"c6197dcf76961b9e","repo":"eyaltoledano/claude-task-master","slug":"invalid-tasks-file","errorCode":"INVALID_TASKS_FILE","errorMessage":"Invalid tasks file or tag \"${tag}\" not found at ${tasksPath}","messagePattern":"Invalid tasks file or tag \"(.+?)\" not found at (.+?)","errorType":"error_code","errorClass":"MoveTaskError","httpStatus":null,"severity":"error","filePath":"scripts/modules/task-manager/move-task.js","lineNumber":164,"sourceCode":"\t\treturn {\n\t\t\tmessage: `Successfully moved ${sourceIds.length} tasks/subtasks`,\n\t\t\tmoves: results\n\t\t};\n\t}\n\n\t// Single move logic\n\t// Read the raw data without tag resolution to preserve tagged structure\n\tlet rawData = readJSON(tasksPath, projectRoot, tag);\n\n\t// Handle the case where readJSON returns resolved data with _rawTaggedData\n\tif (rawData && rawData._rawTaggedData) {\n\t\t// Use the raw tagged data and discard the resolved view\n\t\trawData = rawData._rawTaggedData;\n\t}\n\n\t// Ensure the tag exists in the raw data\n\tif (!rawData || !rawData[tag] || !Array.isArray(rawData[tag].tasks)) {\n\t\tthrow new MoveTaskError(\n\t\t\tMOVE_ERROR_CODES.INVALID_TASKS_FILE,\n\t\t\t`Invalid tasks file or tag \"${tag}\" not found at ${tasksPath}`\n\t\t);\n\t}\n\n\t// Get the tasks for the current tag\n\tconst tasks = rawData[tag].tasks;\n\n\tlog(\n\t\t'info',\n\t\t`Moving task/subtask ${sourceId} to ${destinationId} (tag: ${tag})`\n\t);\n\n\t// Parse source and destination IDs\n\tconst isSourceSubtask = sourceId.includes('.');\n\tconst isDestSubtask = destinationId.includes('.');\n\n\tlet result;","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/move-task.js#L146-L182","documentation":"moveTask reads tasks.json, resolves the tagged view, and requires the target tag to exist in the raw tagged data with a valid tasks array. If the file is missing/invalid, the raw data lacks the tag key, or the tag entry has no tasks array, it throws MoveTaskError with code INVALID_TASKS_FILE.","triggerScenarios":"Calling moveTask with a tag option naming a tag that does not exist in .taskmaster/tasks.json; tasks.json being corrupt, empty, or not containing the expected { tag: { tasks: [...] } } structure; passing a tasksPath pointing to the wrong file.","commonSituations":"Typo in --tag (e.g. 'backlog ' with trailing space, or 'master' vs 'main'); tag deleted by another command or teammate; tasks.json hand-edited and the tag object removed; stale/moved .taskmaster directory so tasksPath points at a nonexistent file.","solutions":["Run `task-master tags` to list valid tags and use one of those exact names for --tag","Create the missing tag with `task-master tags --add <name>` before moving tasks","Validate/repair .taskmaster/tasks.json (ensure it has { \"<tag>\": { \"tasks\": [...] } }) or regenerate it","Confirm the tasksPath argument points to the project's .taskmaster/tasks.json"],"exampleFix":"// before\ntask-master move --from=5 --to=7 --tag=backlogs\n// after (after checking `task-master tags`)\ntask-master move --from=5 --to=7 --tag=backlog","handlingStrategy":"validation","validationCode":"import fs from 'fs';\nfunction assertTagExists(tasksPath, tag) {\n  const raw = JSON.parse(fs.readFileSync(tasksPath, 'utf8'));\n  if (!raw || !raw[tag] || !Array.isArray(raw[tag].tasks)) {\n    throw new Error(`Tag \"${tag}\" not found in ${tasksPath}. Available: ${Object.keys(raw).join(', ')}`);\n  }\n}","typeGuard":"const isValidTaggedData = (raw, tag) =>\n  Boolean(raw) && Boolean(raw[tag]) && Array.isArray(raw[tag]?.tasks);","tryCatchPattern":"try {\n  await moveTask(tasksPath, from, to, false, { projectRoot, tag });\n} catch (err) {\n  if (err.name === 'MoveTaskError' && err.code === 'INVALID_TASKS_FILE') {\n    console.error(`Tag \"${tag}\" missing — run 'task-master tags' and/or 'task-master tags --add ${tag}'`);\n  } else throw err;\n}","preventionTips":["List tags with `task-master tags` and copy names exactly (watch for typos/case)","Create tags before referencing them with `task-master tags --add <name>`","Avoid hand-editing tasks.json; keep the { tag: { tasks: [] } } shape intact","Verify the file path passed as tasksPath resolves to <project>/.taskmaster/tasks.json"],"tags":["file-system","tagging","validation","task-move"],"backgroundTag":"tag-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}