eyaltoledano/claude-task-master · warning

Task ${taskId} depends on non-existent task ${depId}

Error message

  Task ${taskId} depends on non-existent task ${depId}

What it means

Per-item detail line from displayInvalidDependencyWarnings: after the aggregate warning, each of the first 5 invalid pairs is printed as 'Task <taskId> depends on non-existent task <depId>'. It identifies exactly which task/dependency pair is broken.

Source

Thrown at apps/cli/src/commands/list.command.ts:501

	 * @param invalidDependencies - Array of invalid dependency references from buildBlocksMap
	 * @param tagName - Optional tag name for context in multi-tag mode
	 */
	private displayInvalidDependencyWarnings(
		invalidDependencies: InvalidDependency[],
		tagName?: string
	): void {
		if (invalidDependencies.length === 0) {
			return;
		}

		const tagContext = tagName ? ` (tag: ${tagName})` : '';
		console.warn(
			chalk.yellow(
				`\nWarning: ${invalidDependencies.length} invalid dependency reference(s) found${tagContext}:`
			)
		);
		invalidDependencies.slice(0, 5).forEach(({ taskId, depId }) => {
			console.warn(
				chalk.gray(`  Task ${taskId} depends on non-existent task ${depId}`)
			);
		});
		if (invalidDependencies.length > 5) {
			console.warn(
				chalk.gray(`  ...and ${invalidDependencies.length - 5} more`)
			);
		}
	}

	/**
	 * Display results based on format
	 */
	private displayResults(
		result: ListTasksResult,
		options: ListCommandOptions
	): void {
		// Resolve format: --json and --compact flags override --format option

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Edit the offending task to remove the non-existent dependency ID.
  2. Recreate the missing task with the referenced ID if it is needed.
  3. Run a repair/validation pass to clean all dangling dependencies at once.

Example fix

// before
{"id": 2, "dependencies": [1, 7]}
// after — task 7 does not exist
{"id": 2, "dependencies": [1]}
Defensive patterns

Strategy: validation

Validate before calling

const ids = new Set(tasks.map(t => String(t.id)));
for (const t of tasks) {
  for (const d of t.dependencies || []) {
    if (!ids.has(String(d))) {
      t.dependencies = t.dependencies.filter(x => String(x) !== String(d)); // prune
    }
  }
}

Prevention

When it happens

Trigger: Same as the aggregate warning (705): getTasks/getTasksFromAllTags finds a task whose dependencies array contains an ID not present in the loaded task set; this line prints for each such pair (up to 5).

Common situations: Deleted tasks still referenced by survivors; typos in hand-edited dependency IDs; cross-tag references that don't resolve in the current tag.

Related errors


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