eyaltoledano/claude-task-master · error

Parent task with ID ${parentId} not found. Please verify the

Error message

Parent task with ID ${parentId} not found. Please verify the task ID and try again.

What it means

The parent ID parsed from the dotted subtask ID is looked up in data.tasks; if no task with that ID exists the function throws with a user-facing hint. Unlike 410/411 this happens after file and format validation, so the data loaded fine but the parent ID is wrong.

Source

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

		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
		) {
			throw new Error(
				`Invalid subtask ID format: ${subtaskId}. Both parent ID and subtask ID must be positive integers.`
			);
		}

		const parentTask = data.tasks.find((task) => task.id === parentId);
		if (!parentTask) {
			throw new Error(
				`Parent task with ID ${parentId} not found. Please verify the task ID and try again.`
			);
		}

		if (!parentTask.subtasks || !Array.isArray(parentTask.subtasks)) {
			throw new Error(`Parent task ${parentId} has no subtasks.`);
		}

		const subtaskIndex = parentTask.subtasks.findIndex(
			(st) => st.id === subtaskIdNum
		);
		if (subtaskIndex === -1) {
			throw new Error(
				`Subtask with ID ${subtaskId} not found. Please verify the subtask ID and try again.`
			);
		}

		const subtask = parentTask.subtasks[subtaskIndex];

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Run 'task-master list' and confirm the parent task ID
  2. Check the active tag matches the one containing the parent task
  3. Correct the parent portion of the dotted ID

Example fix

// before
await updateSubtaskById('99.1', prompt, options); // no task 99
// after
if (!data.tasks.some(t => t.id === 99)) throw new Error('Parent 99 missing; run task-master list');
await updateSubtaskById('5.1', prompt, options);
Defensive patterns

Strategy: validation

Validate before calling

const parentId = Number(String(subtaskId).split('.')[0]);
if (!data.tasks.some(t => t.id === parentId)) {
  throw new Error(`Parent task ${parentId} not found`);
}

Type guard

function parentExists(tasks, subtaskId) {
  const pid = Number(String(subtaskId).split('.')[0]);
  return tasks.some(t => t.id === pid);
}

Try / catch

try {
  await updateSubtaskById(subtaskId, prompt, options);
} catch (err) {
  if (err.message.startsWith('Parent task with ID') && err.message.includes('not found')) {
    console.error('Verify the parent ID and tag with task-master list');
  } else throw err;
}

Prevention

When it happens

Trigger: Calling updateSubtaskById('99.1', ...) when task 99 does not exist; using a parent ID from a different tag; typos in the parent portion of the ID.

Common situations: Stale IDs after renumbering or pruning tasks, copying subtask IDs between projects, per-tag task lists where the parent only exists in another tag.

Related errors


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