eyaltoledano/claude-task-master · error
No tasks found in the tasks file
Error message
No tasks found in the tasks file
What it means
analyzeTaskComplexity() reads the tasks file and requires a tasks array with at least one entry before running the AI complexity analysis. An empty, missing, or malformed tasks payload makes the analysis meaningless, so it fails fast.
Source
Thrown at scripts/modules/task-manager/analyze-task-complexity.js:117
if (!options._originalTaskCount) {
try {
originalData = readJSON(tasksPath, projectRoot, tag);
if (originalData && originalData.tasks) {
originalTaskCount = originalData.tasks.length;
}
} catch (e) {
log('warn', `Could not read original tasks file: ${e.message}`);
}
}
} else {
originalData = readJSON(tasksPath, projectRoot, tag);
if (
!originalData ||
!originalData.tasks ||
!Array.isArray(originalData.tasks) ||
originalData.tasks.length === 0
) {
throw new Error('No tasks found in the tasks file');
}
originalTaskCount = originalData.tasks.length;
// Filter tasks based on active status
const activeStatuses = ['pending', 'blocked', 'in-progress'];
let filteredTasks = originalData.tasks.filter((task) =>
activeStatuses.includes(task.status?.toLowerCase() || 'pending')
);
// Apply ID filtering if specified
if (specificIds && specificIds.length > 0) {
reportLog(
`Filtering tasks by specific IDs: ${specificIds.join(', ')}`,
'info'
);
filteredTasks = filteredTasks.filter((task) =>
specificIds.includes(task.id)
);View on GitHub (pinned to c0c98d367c)
Solutions
- Add tasks first (add-task or parse-prd) and re-run the complexity analysis.
- Validate/repair tasks.json — ensure it parses as JSON with a non-empty tasks array.
- Check you are analyzing the correct file/tag; switch to the tag that contains tasks.
Example fix
// before
npx task-master analyze-complexity # tasks.json has { tasks: [] }
// after
task-master add-task --prompt "Implement auth" && task-master analyze-complexity Defensive patterns
Strategy: validation
Validate before calling
const data = JSON.parse(fs.readFileSync('.taskmaster/tasks/tasks.json', 'utf8'));
if (!Array.isArray(data.tasks) || data.tasks.length === 0) {
throw new Error('Add tasks before running complexity analysis');
} Type guard
function hasTasks(data) {
return !!data && Array.isArray(data.tasks) && data.tasks.length > 0;
} Try / catch
try {
await analyzeTaskComplexity(options);
} catch (err) {
if (err.message === 'No tasks found in the tasks file') {
console.error('tasks.json is empty or invalid — add tasks first.');
} else throw err;
} Prevention
- Run parse-prd/add-task before analyze-complexity on a fresh project.
- Lint tasks.json after any manual edit.
- Check the active tag actually contains tasks before analyzing.
When it happens
Trigger: Running analyze complexity (CLI `analyze-complexity`, `reanalyze`, or the report/complexity display path) when tasks.json is empty ({ tasks: [] }), corrupted so tasks is not an array, or readJSON returned null due to a parse failure.
Common situations: New project where tasks.json was initialized but no tasks added yet; manual edits to tasks.json that broke the array; pointing --file at the wrong JSON file; all tasks in an inactive tag so the raw array exists but validation happens before tag filtering.
Related errors
- Invalid tasks data in ${tasksPath}
- Invalid tasks data in ${tasksPath}
- MFA_VERIFICATION_FAILED
- Failed to initialize services: ${(error as Error).message}
- Invalid format: ${options.format}. Valid formats are: text,
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/8e967dc1c0352327.
Report an issue: GitHub.