eyaltoledano/claude-task-master · error

No valid tasks found in ${tasksPath}

Error message

No valid tasks found in ${tasksPath}

What it means

listTasks() attempts to load tasks (preferring tm-core, falling back to legacy readJSON) and requires a data object containing a tasks array. If both paths fail to yield tasks data, it throws, naming the resolved tasks file path.

Source

Thrown at scripts/modules/task-manager/list-tasks.js:70

			// Load tasks via tm-core tasks domain (supports both file and API storage)
			const result = await tmCore.tasks.list({ tag });
			data = { tasks: result.tasks };

			log(
				'debug',
				`Loaded ${result.tasks.length} tasks via tm-core (${result.storageType} storage)`
			);
		} catch (storageError) {
			log(
				'warn',
				`TmCore failed, falling back to legacy readJSON: ${storageError.message}`
			);
			// Fallback to old readJSON if tm-core fails
			data = readJSON(tasksPath, projectRoot, tag);
		}

		if (!data || !data.tasks) {
			throw new Error(`No valid tasks found in ${tasksPath}`);
		}

		// Add complexity scores to tasks if report exists
		// `reportPath` is already tag-aware (resolved at the CLI boundary).
		const complexityReport = readComplexityReport(reportPath);
		// Apply complexity scores to tasks
		if (complexityReport && complexityReport.complexityAnalysis) {
			data.tasks.forEach((task) => addComplexityToTask(task, complexityReport));
		}

		// Filter tasks by status if specified - now supports comma-separated statuses
		let filteredTasks;
		if (statusFilter && statusFilter.toLowerCase() !== 'all') {
			// Handle comma-separated statuses
			const allowedStatuses = statusFilter
				.split(',')
				.map((s) => s.trim().toLowerCase())
				.filter((s) => s.length > 0); // Remove empty strings

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Validate the tasks file at the path in the message is valid JSON with a tasks array; fix syntax errors.
  2. If no tasks exist yet, create them via add-task or parse-prd before listing.
  3. Run from the correct project root and confirm the active tag resolves to an existing tasks file.

Example fix

// before
$ task-master list  # .taskmaster/tasks/tasks.json missing
// after
$ task-master parse-prd prd.txt && task-master list
Defensive patterns

Strategy: type-guard

Validate before calling

const fs = require('fs');
if (!fs.existsSync(tasksPath)) throw new Error(`Tasks file missing: ${tasksPath}`);
const data = JSON.parse(fs.readFileSync(tasksPath, 'utf8'));
if (!Array.isArray(data.tasks)) throw new Error(`${tasksPath} has no tasks array`);

Type guard

function isListableTasksData(v) {
  return !!v && typeof v === 'object' && Array.isArray(v.tasks);
}

Try / catch

try {
  const tasks = await listTasks(options);
} catch (err) {
  if (err.message.startsWith('No valid tasks found in')) {
    console.error(`Tasks file missing/invalid at ${tasksPath} — run parse-prd or add-task first.`);
  } else throw err;
}

Prevention

When it happens

Trigger: Both tm-core loadTasks and readJSON(tasksPath, projectRoot, tag) return null/undefined or an object without tasks — missing tasks file, invalid JSON, or wrong projectRoot/tag resolution before any listing occurs.

Common situations: Running `task-master list` in a project whose tasks.json was deleted or never created; JSON syntax error from hand-editing or a bad merge; pointing --file at a non-tasks JSON document; incorrect active tag with no corresponding file.

Related errors


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