eyaltoledano/claude-task-master · error · MoveTaskError
INVALID_TASKS_FILE
INVALID_TASKS_FILE
Error message
Invalid tasks file or tag "${tag}" not found at ${tasksPath} What it means
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.
Source
Thrown at scripts/modules/task-manager/move-task.js:164
return {
message: `Successfully moved ${sourceIds.length} tasks/subtasks`,
moves: results
};
}
// Single move logic
// Read the raw data without tag resolution to preserve tagged structure
let rawData = readJSON(tasksPath, projectRoot, tag);
// Handle the case where readJSON returns resolved data with _rawTaggedData
if (rawData && rawData._rawTaggedData) {
// Use the raw tagged data and discard the resolved view
rawData = rawData._rawTaggedData;
}
// Ensure the tag exists in the raw data
if (!rawData || !rawData[tag] || !Array.isArray(rawData[tag].tasks)) {
throw new MoveTaskError(
MOVE_ERROR_CODES.INVALID_TASKS_FILE,
`Invalid tasks file or tag "${tag}" not found at ${tasksPath}`
);
}
// Get the tasks for the current tag
const tasks = rawData[tag].tasks;
log(
'info',
`Moving task/subtask ${sourceId} to ${destinationId} (tag: ${tag})`
);
// Parse source and destination IDs
const isSourceSubtask = sourceId.includes('.');
const isDestSubtask = destinationId.includes('.');
let result;View on GitHub (pinned to c0c98d367c)
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
Example fix
// before task-master move --from=5 --to=7 --tag=backlogs // after (after checking `task-master tags`) task-master move --from=5 --to=7 --tag=backlog
Defensive patterns
Strategy: validation
Validate before calling
import fs from 'fs';
function assertTagExists(tasksPath, tag) {
const raw = JSON.parse(fs.readFileSync(tasksPath, 'utf8'));
if (!raw || !raw[tag] || !Array.isArray(raw[tag].tasks)) {
throw new Error(`Tag "${tag}" not found in ${tasksPath}. Available: ${Object.keys(raw).join(', ')}`);
}
} Type guard
const isValidTaggedData = (raw, tag) => Boolean(raw) && Boolean(raw[tag]) && Array.isArray(raw[tag]?.tasks);
Try / catch
try {
await moveTask(tasksPath, from, to, false, { projectRoot, tag });
} catch (err) {
if (err.name === 'MoveTaskError' && err.code === 'INVALID_TASKS_FILE') {
console.error(`Tag "${tag}" missing — run 'task-master tags' and/or 'task-master tags --add ${tag}'`);
} else throw err;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- ID_COUNT_MISMATCH
- PARENT_TASK_NOT_FOUND
- PARENT_TASK_NO_SUBTASKS
- Tag name is required and must be a string
- Tag name can only contain letters, numbers, hyphens, and und
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/c6197dcf76961b9e.
Report an issue: GitHub.