eyaltoledano/claude-task-master · error

Tasks file not found at path: ${tasksPath}

Error message

Tasks file not found at path: ${tasksPath}

What it means

In file-storage mode the function checks fs.existsSync(tasksPath) before reading. If the tasks file does not exist at the resolved path it throws with the full path in the message.

Source

Thrown at scripts/modules/task-manager/update-subtask-by-id.js:130

		if (remoteResult) {
			return {
				updatedSubtask: { id: subtaskId },
				telemetryData: remoteResult.telemetryData,
				tagInfo: remoteResult.tagInfo
			};
		}
		// Otherwise fall through to file-based logic below
		// --- End BRIDGE ---

		// For file storage, validate the subtask ID format (must contain a dot)
		if (!subtaskId.includes('.')) {
			throw new Error(
				`Invalid subtask ID format: ${subtaskId}. In solo mode, subtask ID must be in format "parentId.subtaskId" (e.g., "5.2").`
			);
		}

		if (!fs.existsSync(tasksPath)) {
			throw new Error(`Tasks file not found at path: ${tasksPath}`);
		}

		const data = readJSON(tasksPath, projectRoot, tag);
		if (!data || !data.tasks) {
			throw new Error(
				`No valid tasks found in ${tasksPath}. The file may be corrupted or have an invalid format.`
			);
		}

		const [parentIdStr, subtaskIdStr] = subtaskId.split('.');
		const parentId = parseInt(parentIdStr, 10);
		const subtaskIdNum = parseInt(subtaskIdStr, 10);

		if (
			Number.isNaN(parentId) ||
			parentId <= 0 ||
			Number.isNaN(subtaskIdNum) ||
			subtaskIdNum <= 0

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Verify the path exists: ls .taskmaster/tasks.json
  2. Run 'task-master init' or 'task-master generate' to create the file
  3. Pass the correct --file path explicitly

Example fix

// before
await updateSubtaskById('5.2', prompt, { tasksPath: './tasks.json' }); // wrong path
// after
const tasksPath = path.join(projectRoot, '.taskmanager', 'tasks.json');
if (!fs.existsSync(tasksPath)) throw new Error(`Missing ${tasksPath}; run task-master init`);
await updateSubtaskById('5.2', prompt, { tasksPath });
Defensive patterns

Strategy: validation

Validate before calling

if (!fs.existsSync(tasksPath)) {
  throw new Error(`Tasks file missing: ${tasksPath}`);
}

Type guard

null

Try / catch

try {
  await updateSubtaskById(subtaskId, prompt, options);
} catch (err) {
  if (err.message.startsWith('Tasks file not found')) {
    console.error(`Initialize the project (task-master init) or fix --file: ${err.message}`);
  } else throw err;
}

Prevention

When it happens

Trigger: tasksPath pointing at a missing .taskmaster/tasks.json, wrong --file flag value, or a project where tasks.json was never initialized or was deleted.

Common situations: Typos in the file path, running in CI before the tasks file is generated, switching branches where tasks.json is gitignored and absent.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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