ruvnet/ruflo · error
Task ${taskId} not found
Error message
Task ${taskId} not found What it means
assignTaskToDomain() looks the task up in state.tasks by exact id string; unknown ids throw before domain routing starts. Task ids are only valid within the same coordinator instance and only while the task still lives in the map, so replaying ids from another swarm or a previous run always fails.
Source
Thrown at v3/@claude-flow/swarm/src/unified-coordinator.ts:1106
getAgentPool(type: AgentType): AgentPool | undefined {
return this.agentPools.get(type);
}
// =============================================================================
// DOMAIN-BASED TASK ROUTING (15-Agent Hierarchy Support)
// =============================================================================
/**
* Assign a task to a specific domain
* Routes the task to the most suitable agent within that domain
*/
async assignTaskToDomain(taskId: string, domain: AgentDomain): Promise<string | undefined> {
const startTime = performance.now();
const task = this.state.tasks.get(taskId);
if (!task) {
throw new Error(`Task ${taskId} not found`);
}
const pool = this.domainPools.get(domain);
if (!pool) {
throw new Error(`Domain pool ${domain} not found`);
}
// Try to acquire an agent from the domain pool
const agent = await pool.acquire();
if (!agent) {
// Add to domain queue if no agents available
const queue = this.domainTaskQueues.get(domain) || [];
queue.push(taskId);
this.domainTaskQueues.set(domain, queue);
task.status = 'queued';
this.emitEvent('task.queued', {
taskId,View on GitHub (pinned to fa13ee4ad6)
Solutions
- Use the id returned by submitTask() on the same coordinator instance
- Validate the id still exists in coordinator state before assigning to a domain
- If tasks can be pruned, re-submit the task instead of replaying a stale id
Example fix
// before
await coordinator.assignTaskToDomain('task_oldswarm_1', 'development'); // throws: foreign id
// after
const taskId = await coordinator.submitTask(taskData);
await coordinator.assignTaskToDomain(taskId, 'development'); Defensive patterns
Strategy: validation
Validate before calling
// Track ids you created on this coordinator instance
const submitted = new Set<string>();
const id = await coordinator.submitTask(taskData);
submitted.add(id);
if (!submitted.has(taskId)) {
throw new Error(`Refusing to assign unknown task ${taskId}`);
}
await coordinator.assignTaskToDomain(taskId, domain); Type guard
function isSubmittedTaskId(taskId: string, submitted: Set<string>): taskId is string {
return submitted.has(taskId);
} Try / catch
try {
await coordinator.assignTaskToDomain(taskId, domain);
} catch (err) {
if (err instanceof Error && err.message.startsWith(`Task ${taskId} not found`)) {
const freshId = await coordinator.submitTask(taskData); // resubmit and route
return coordinator.assignTaskToDomain(freshId, domain);
}
throw err;
} Prevention
- Treat task ids as ephemeral handles, not durable identifiers
- Always capture and pass the submitTask() return value
- Never replay recorded ids across coordinator restarts without resubmitting
When it happens
Trigger: Calling assignTaskToDomain() with an id from a different swarm or coordinator, a completed-and-pruned task, or a hand-typed id; races where the task was cancelled between creation and assignment.
Common situations: Durable job queues replaying old ids against a fresh coordinator; typos in scripts; persisted task ids reused after a restart.
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
- Domain pool ${domain} not found
- hexToBytes: odd-length hex string
- SSRF guard: only HTTPS URLs are permitted, got ${parsed.prot
- SSRF guard: private/loopback host rejected — ${host}
- SSRF guard: invalid URL — ${rawUrl}
AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18).
Data as JSON: /api/errors/89ee7f43ba652c81.
Report an issue: GitHub.