eyaltoledano/claude-task-master · error

Task ${taskId} not found

Error message

Task ${taskId} not found

What it means

For non-dotted ID inputs, updateSingleTaskStatus parses the input as an integer and searches the top-level tasks array. It throws when no task with that numeric ID exists in the loaded data.

Source

Thrown at scripts/modules/task-manager/update-single-task-status.js:96

						chalk.yellow(
							`All subtasks of parent task ${parentId} are now marked as done.`
						)
					);
					console.log(
						chalk.yellow(
							`Consider updating the parent task status with: task-master set-status --id=${parentId} --status=done`
						)
					);
				}
			}
		}
	} else {
		// Handle regular task
		const taskId = parseInt(taskIdInput, 10);
		const task = data.tasks.find((t) => t.id === taskId);

		if (!task) {
			throw new Error(`Task ${taskId} not found`);
		}

		// Update the task status
		const oldStatus = task.status || 'pending';
		task.status = newStatus;

		log(
			'info',
			`Updated task ${taskId} status from '${oldStatus}' to '${newStatus}'`
		);

		// If marking as done, also mark all subtasks as done
		if (
			(newStatus.toLowerCase() === 'done' ||
				newStatus.toLowerCase() === 'completed') &&
			task.subtasks &&
			task.subtasks.length > 0
		) {

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Run 'task-master list' to see current task IDs
  2. Confirm the correct --tag/context is being used
  3. Re-run with the exact numeric ID from the list output

Example fix

// before
await setTaskStatus('42', 'done', tasksPath); // task 42 deleted
// after
const id = Number('42');
if (!data.tasks.some(t => t.id === id)) {
  console.error(`Task ${id} not found; run task-master list`);
  process.exit(1);
}
await setTaskStatus('42', 'done', tasksPath);
Defensive patterns

Strategy: validation

Validate before calling

const id = Number(taskIdInput);
if (!Number.isInteger(id) || !data.tasks.some(t => t.id === id)) {
  throw new Error(`Task ${taskIdInput} not found`);
}

Type guard

function taskExists(tasks, id) {
  return tasks.some(t => t.id === Number(id));
}

Try / catch

try {
  await setTaskStatus(taskId, 'done', tasksPath);
} catch (err) {
  if (err.message === `Task ${taskId} not found`) {
    console.error('Run task-master list to get valid IDs');
  } else throw err;
}

Prevention

When it happens

Trigger: setTaskStatus called with a plain numeric ID ('7') that is not in data.tasks; passing a string that parses to a different number than intended; referencing a task in a tag where it does not exist.

Common situations: Hardcoded IDs from documentation or an older task list, tasks deleted after a cleanup, or switching tags where task numbering differs.

Related errors


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