ruvnet/ruflo · error
Task not found: ${taskId}
Error message
Task not found: ${taskId} What it means
TaskManager.assignTask() resolves taskId through its in-memory tasks Map and throws when absent, before setting assignedAgent and status='assigned'. Only tasks created via createTask() (which mints a secure ID) exist in the map, so foreign or stale IDs cannot be assigned.
Source
Thrown at v3/@claude-flow/shared/src/core/orchestrator/task-manager.ts:151
if (filter) {
if (filter.status) {
tasks = tasks.filter(t => t.status === filter.status);
}
if (filter.type) {
tasks = tasks.filter(t => t.type === filter.type);
}
if (filter.assignedAgent) {
tasks = tasks.filter(t => t.assignedAgent === filter.assignedAgent);
}
}
return tasks;
}
async assignTask(taskId: string, agentId: string): Promise<void> {
const task = this.tasks.get(taskId);
if (!task) {
throw new Error(`Task not found: ${taskId}`);
}
task.assignedAgent = agentId;
task.status = 'assigned';
this.eventBus.emit(SystemEventTypes.TASK_ASSIGNED, {
taskId,
agentId,
});
}
async startTask(taskId: string): Promise<void> {
const task = this.tasks.get(taskId);
if (!task) {
throw new Error(`Task not found: ${taskId}`);
}
task.status = 'running';View on GitHub (pinned to fa13ee4ad6)
Solutions
- Verify with taskManager.getTask(taskId) before assigning
- Create the task first via createTask() and use the returned task.id
- Ensure producer and consumer share the same TaskManager instance or re-create tasks locally
Example fix
// before
await taskManager.assignTask(taskId, agentId);
// after
if (taskManager.getTask(taskId)) {
await taskManager.assignTask(taskId, agentId);
} Defensive patterns
Strategy: validation
Validate before calling
const task = taskManager.getTask(taskId);
if (!task) throw new Error(`unknown task ${taskId}`);
await taskManager.assignTask(taskId, agentId); Type guard
const task = taskManager.getTask(taskId);
if (task && task.status === 'pending') {
await taskManager.assignTask(task.id, agentId);
} Try / catch
try {
await taskManager.assignTask(taskId, agentId);
} catch (e) {
if (e instanceof Error && e.message.startsWith('Task not found')) {
// drop or re-create the task; the ID is unknown to this manager
} else throw e;
} Prevention
- Only use IDs returned by createTask() on the same TaskManager instance
- Check getTask() before every state transition
- Do not ship task IDs across process boundaries without re-creating tasks locally
When it happens
Trigger: Calling assignTask(taskId, agentId) with an ID not returned by createTask(); assigning tasks whose manager instance was recreated (e.g. after a restart); race where the task was cancelled and removed concurrently.
Common situations: Distributing task IDs via queues/IPC and consuming them in a process that never created those tasks; test setups reusing hard-coded IDs; multiple TaskManager instances sharding work.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- Failed to create share link
- SSRF guard: private/loopback host rejected — ${host}
- JSON.stringify(response.error)
- User not found
- User token not found
AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18).
Data as JSON: /api/errors/698ddd4bc9fd8e49.
Report an issue: GitHub.