eyaltoledano/claude-task-master · error · Error

Task with ID ${taskId} not found

Error message

Task with ID ${taskId} not found

What it means

scopeUpTask() first loads tasks.json via readJSON and validates every requested ID with taskExists() before mutating anything. This pre-flight check throws when any ID in the taskIds array does not exist under the active tag, preventing partial updates. It fires before the per-task processing loop, so nothing has been modified yet.

Source

Thrown at scripts/modules/task-manager/scope-adjustment.js:634

	outputFormat = 'text'
) {
	// Validate inputs
	if (!validateStrength(strength)) {
		throw new Error(
			`Invalid strength level: ${strength}. Must be one of: ${VALID_STRENGTHS.join(', ')}`
		);
	}

	const { projectRoot = '.', tag = 'master' } = context;

	// Read tasks data
	const data = readJSON(tasksPath, projectRoot, tag);
	const tasks = data?.tasks || [];

	// Validate all task IDs exist
	for (const taskId of taskIds) {
		if (!taskExists(tasks, taskId)) {
			throw new Error(`Task with ID ${taskId} not found`);
		}
	}

	const updatedTasks = [];
	let combinedTelemetryData = null;

	// Process each task
	for (const taskId of taskIds) {
		const taskResult = findTaskById(tasks, taskId);
		const task = taskResult.task;
		if (!task) {
			throw new Error(`Task with ID ${taskId} not found`);
		}

		if (outputFormat === 'text') {
			log('info', `Scoping up task ${taskId}: ${task.title}`);
		}

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Verify all IDs with task-master list (or task-master show <id>) in the active tag before calling scopeUpTask.
  2. Remove nonexistent IDs from the taskIds array or split the batch into valid IDs only.
  3. Confirm the correct tag via context = { tag: '...' } — the task may exist in another tag.
  4. Use main task IDs, not subtask IDs, for this function; subtasks belong to scope operations on the parent task.

Example fix

// before
await scopeUpTask([1, 2, 99], 'regular'); // 99 missing
// after
const existing = [1, 2, 99].filter((id) => taskExists(tasks, id));
await scopeUpTask(existing, 'regular');
Defensive patterns

Strategy: validation

Validate before calling

const tasks = readJSON(tasksPath, projectRoot, tag)?.tasks || [];
const missing = taskIds.filter((id) => !taskExists(tasks, id));
if (missing.length) {
  throw new Error(`Cannot scope up: task(s) not found in tag '${tag}': ${missing.join(', ')}`);
}
await scopeUpTask(taskIds, strength, null, { tag });

Type guard

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

Try / catch

try {
  await scopeUpTask(taskIds, strength);
} catch (err) {
  const m = err.message.match(/Task with ID (\S+) not found/);
  if (m) {
    console.error(`Task ${m[1]} missing; valid IDs: ${tasks.map((t) => t.id).join(', ')}`);
  } else throw err;
}

Prevention

When it happens

Trigger: Calling scopeUpTask([4, 99], 'regular') where task 99 is absent, batch calls containing an already-deleted task ID, subtask-style IDs ('5.2') passed to a function expecting main task IDs, or reading from a tag where the task does not exist.

Common situations: Batch scope-up of stale ID lists from a report, IDs referencing another tag's tasks, deleted tasks still referenced by automation scripts, or typo'd IDs in CI pipelines.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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