eyaltoledano/claude-task-master · error

No valid tasks found in ${tasksPath}

Error message

No valid tasks found in ${tasksPath}

What it means

updateTasks reads tasks.json via readJSON and requires both the parsed object and its tasks array. If tasks.json is missing, unreadable, corrupt, or lacks a tasks array, this error is thrown with the attempted path.

Source

Thrown at scripts/modules/task-manager/update-tasks.js:77

	try {
		if (isMCP) logFn.info(`Updating tasks from ID ${fromId}`);
		else
			logFn(
				'info',
				`Updating tasks from ID ${fromId} with prompt: "${prompt}"`
			);

		// Determine project root
		const projectRoot = providedProjectRoot || findProjectRoot();
		if (!projectRoot) {
			throw new Error('Could not determine project root directory');
		}

		// --- Task Loading/Filtering (Updated to pass projectRoot and tag) ---
		const data = readJSON(tasksPath, projectRoot, tag);
		if (!data || !data.tasks)
			throw new Error(`No valid tasks found in ${tasksPath}`);
		const tasksToUpdate = data.tasks.filter(
			(task) => task.id >= fromId && task.status !== 'done'
		);
		if (tasksToUpdate.length === 0) {
			if (isMCP)
				logFn.info(`No tasks to update (ID >= ${fromId} and not 'done').`);
			else
				logFn('info', `No tasks to update (ID >= ${fromId} and not 'done').`);
			if (outputFormat === 'text') console.log(/* yellow message */);
			return; // Nothing to do
		}
		// --- End Task Loading/Filtering ---

		// --- Context Gathering ---
		let gatheredContext = '';
		try {
			const contextGatherer = new ContextGatherer(projectRoot, tag);
			const allTasksFlat = flattenTasksWithSubtasks(data.tasks);

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Confirm .taskmaster/tasks.json exists and contains {"tasks": [...]} at the resolved project root
  2. Run 'task-master init' or 'task-master parse-prd' to create tasks.json if missing
  3. Validate/repair tasks.json with a JSON linter if it was hand-edited
  4. Check you are operating on the intended tag (current tag state.json) that actually has tasks
Defensive patterns

Strategy: validation

Validate before calling

import fs from 'fs';
const tasksPath = `${projectRoot}/.taskmaster/tasks.json`;
if (!fs.existsSync(tasksPath)) throw new Error('tasks.json missing; run task-master parse-prd');
const data = JSON.parse(fs.readFileSync(tasksPath, 'utf8'));
if (!Array.isArray(data?.tasks)) throw new Error('tasks.json invalid');

Type guard

const isValidTasksData = (d) => !!d && typeof d === 'object' && Array.isArray(d.tasks);

Try / catch

try {
  await updateTasks(...);
} catch (e) {
  if (e.message.startsWith('No valid tasks found in')) {
    // regenerate tasks.json or fix JSON corruption
  } else throw e;
}

Prevention

When it happens

Trigger: tasks.json does not exist at <projectRoot>/.taskmaster/tasks.json, readJSON returns null (parse failure or missing file), or the JSON parses but has no tasks key.

Common situations: Fresh projects with no tasks yet, manually edited/corrupted tasks.json, running from a different tag context where the tag has no tasks, or wrong projectRoot passed programmatically.

Related errors


AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29). Data as JSON: /api/errors/f8cba0d0881aa5eb. Report an issue: GitHub.