ruvnet/ruflo · error
Agent ${this.id} is not available (status: ${this.status})
Error message
Agent ${this.id} is not available (status: ${this.status}) What it means
Thrown by AgenticFlowAgent#executeTask (v3/@claude-flow/integration/src/agentic-flow-agent.ts:490) when the agent's status is 'terminated' or 'error'. Dead or errored agents refuse new work so failures do not compound; the message embeds the offending status so you know which branch tripped.
Source
Thrown at v3/@claude-flow/integration/src/agentic-flow-agent.ts:490
/**
* Execute a task
*
* ADR-001: When agentic-flow is available, delegates task execution
* to agentic-flow's Agent.execute() which leverages:
* - Flash Attention for 2.49x-7.47x faster processing
* - SONA learning for real-time adaptation
* - AgentDB for 150x-12,500x faster memory retrieval
*
* @param task - Task to execute
* @returns Task result with output or error
*/
async executeTask(task: Task): Promise<TaskResult> {
this.ensureInitialized();
// Validate agent is available
if (this.status === 'terminated' || this.status === 'error') {
throw new Error(`Agent ${this.id} is not available (status: ${this.status})`);
}
// Check concurrent task limit
if (this.currentTaskCount >= this.config.maxConcurrentTasks) {
throw new Error(`Agent ${this.id} has reached max concurrent tasks`);
}
this.currentTask = task;
this.currentTaskCount++;
this.status = 'busy';
this.taskStartTime = Date.now();
this.lastActivity = new Date();
this.emit('task-started', {
agentId: this.id,
taskId: task.id,
taskType: task.type,
});View on GitHub (pinned to fa13ee4ad6)
Solutions
- Check agent.status (or a public availability getter) before dispatch and skip/recreate terminated or errored agents.
- After any task failure, either call initialize() to recycle the agent or remove it from the pool and spawn a replacement.
- In a scheduler loop, wrap dispatch in try/catch and treat this message as 'evict and respawn' rather than fatal.
- Ensure terminate() is only called when the agent is being retired, and that nothing re-dispatches afterwards.
Example fix
// before
const result = await agent.executeTask(task); // agent.status === 'terminated'
// after
if (agent.status === 'terminated' || agent.status === 'error') {
await agent.initialize(); // recycle, or replace the agent
}
const result = await agent.executeTask(task); Defensive patterns
Strategy: validation
Validate before calling
const AVAIL = new Set(['idle', 'busy', 'initialized']);
if (!AVAIL.has(agent.status) || agent.status === 'terminated' || agent.status === 'error') {
await agent.initialize(); // recycle or replace
} Type guard
function isAgentAvailable(a: { status: string }): boolean {
return a.status !== 'terminated' && a.status !== 'error';
} Try / catch
try {
return await agent.executeTask(task);
} catch (e) {
if (/is not available \(status:/.test((e as Error).message)) {
pool.evict(agent.id);
return pool.spawn().executeTask(task);
}
throw e;
} Prevention
- Check status before dispatch and evict dead agents from pools immediately.
- Recycle errored agents via initialize() or replace them — never leave them dispatchable.
- After task failures, decide the agent's fate explicitly instead of leaving status 'error'.
When it happens
Trigger: Calling executeTask after agent.terminate() or after a previous task put the agent into status 'error'; a swarm scheduler that has not yet replaced a crashed agent still dispatching to it; resuming a queue whose agent references were persisted past their lifetime.
Common situations: Reusing agent objects across test runs without re-initializing; error-handling code that swallows a prior failure and keeps the agent in the pool; long-lived pools where terminated agents are not evicted.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- Agent ${this.id} not initialized. Call initialize() first.
- No active task to checkpoint
- Agent not found: ${agentId}
- Cannot start terminated agent
- Can only pause active or busy agent
AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18).
Data as JSON: /api/errors/49829edddf6e2569.
Report an issue: GitHub.