eyaltoledano/claude-task-master · warning
Could not determine complete execution order for task ${task
Error message
Could not determine complete execution order for task ${task.id} What it means
task-loader.service.ts getExecutionOrder() topologically orders subtasks by their dependencies. If a full pass adds no new subtask while some remain unadded, it logs this warning and falls back to appending the remaining subtasks in their original file order to avoid an infinite loop.
Source
Thrown at packages/tm-core/src/modules/tasks/services/task-loader.service.ts:360
}
// Check if all dependencies are completed
const allDepsCompleted =
!subtask.dependencies ||
subtask.dependencies.length === 0 ||
subtask.dependencies.every((depId) => completed.has(String(depId)));
if (allDepsCompleted) {
ordered.push(subtask);
completed.add(subtaskId);
added = true;
break;
}
}
// Safety check to prevent infinite loop
if (!added && ordered.length < task.subtasks.length) {
logger.warn(
`Could not determine complete execution order for task ${task.id}`
);
// Add remaining subtasks in original order
for (const subtask of task.subtasks) {
if (!completed.has(String(subtask.id))) {
ordered.push(subtask);
}
}
break;
}
}
return ordered;
}
/**
* Clean up resources
*/View on GitHub (pinned to c0c98d367c)
Solutions
- Fix the dependency cycles among the task's subtasks in tasks.json (break the loop)
- Remove or correct dependencies that point to subtask IDs that don't exist
- Re-derive dependencies (or accept the fallback original-order execution) if ordering is not strict
- Add validation of the dependency graph when creating/editing subtasks to prevent cycles
Example fix
// before // subtask 2: dependencies [3]; subtask 3: dependencies [2] // after // subtask 2: dependencies []; subtask 3: dependencies [2]
Defensive patterns
Strategy: validation
Validate before calling
function hasCircularDeps(task: Task): boolean {
const ids = new Set(task.subtasks.map(s => String(s.id)));
const state: Record<string, 0|1|2> = {};
const visit = (id: string): boolean => {
if (state[id] === 1) return true;
if (state[id] === 2) return false;
state[id] = 1;
const st = task.subtasks.find(s => String(s.id) === id);
for (const d of st?.dependencies ?? []) if (ids.has(String(d)) && visit(String(d))) return true;
state[id] = 2; return false;
};
return task.subtasks.some(s => visit(String(s.id)));
}
if (hasCircularDeps(task)) throw new Error(`Task ${task.id}: circular subtask dependencies`); Prevention
- Validate the subtask dependency graph after any manual tasks.json edit
- Use dependency validation on import/merge of task data
- Avoid renaming subtask IDs without updating dependencies
- Keep dependencies pointing forward (lower ID depends on higher, or DAG by design)
When it happens
Trigger: getExecutionOrder() on a task whose subtasks have circular dependencies (e.g. subtask 1.2 depends on 1.3 and 1.3 depends on 1.2) or dependencies referencing nonexistent subtask IDs, so no valid ordering exists.
Common situations: Hand-edited tasks.json introducing a dependency cycle, imports/merges that created dangling dependency IDs, or a rename of subtask IDs without updating dependencies.
Related errors
- Cannot create circular dependency: task ${parentIdNum} is al
- Invalid iterations: ${iterations}. Must be a positive intege
- Invalid format: ${options.format}. Valid formats are: text,
- Parent task with ID ${parentIdNum} not found
- Task with ID ${existingTaskIdNum} not found
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/4be40eb8555c64eb.
Report an issue: GitHub.