eyaltoledano/claude-task-master · warning

Warning: ${invalidDependencies.length} invalid dependency re

Error message

Warning: ${invalidDependencies.length} invalid dependency reference(s) found${tagContext}:

What it means

displayInvalidDependencyWarnings in list.command.ts warns when tasks reference dependencies that don't exist. The header line reports the count of invalid references and, optionally, the tag being examined. It is a data-integrity warning emitted during task listing, not a thrown exception.

Source

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

			allTags: true
		};
	}

	/**
	 * Display warnings for invalid dependency references
	 * @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

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Fix or remove the dangling dependency entries in the affected tasks (edit tasks.json or use dependency remove).
  2. Recreate the missing task if it should exist, restoring the referenced ID.
  3. Run a dependency-validation/repair command to prune invalid references in bulk.
  4. Check the per-task detail lines following this warning to see exactly which pairs are broken.

Example fix

// before (tasks.json)
"dependencies": [3, 99]
// after — remove reference to non-existent task 99
"dependencies": [3]
Defensive patterns

Strategy: validation

Validate before calling

function findDanglingDeps(tasks) {
  const ids = new Set(tasks.map(t => String(t.id)));
  return tasks.flatMap(t =>
    (t.dependencies || [])
      .map(String)
      .filter(d => !ids.has(d))
      .map(d => ({ taskId: t.id, depId: d }))
  );
}

Prevention

When it happens

Trigger: Calling getTasks or getTasksFromAllTags when the fetched task set is passed through dependency validation and one or more tasks list a dependency ID absent from the task collection.

Common situations: Manually edited tasks.json removing a task but leaving dangling references; task IDs reused/renamed across tags; merge conflicts partially resolved; imports from other projects with mismatched IDs.

Related errors


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