ruvnet/ruflo · error
AgentAdapter not initialized. Call initialize() first.
Error message
AgentAdapter not initialized. Call initialize() first.
What it means
Thrown by AgentAdapter#ensureInitialized() (v3/@claude-flow/integration/src/agent-adapter.ts:600). Most operational methods call this guard first, so invoking any of them before await adapter.initialize() completed (or after a failed initialize) raises this error immediately.
Source
Thrown at v3/@claude-flow/integration/src/agent-adapter.ts:600
};
const mappedStatus = statusMap[agenticFlowAgent.status.toLowerCase()];
if (mappedStatus && mappedStatus !== agent.status) {
agent.status = mappedStatus;
this.emit('status-synced', {
agentId: agent.id,
from: agenticFlowAgent.status,
to: mappedStatus,
});
}
}
/**
* Ensure adapter is initialized
*/
private ensureInitialized(): void {
if (!this.initialized) {
throw new Error('AgentAdapter not initialized. Call initialize() first.');
}
}
/**
* Debug logging
*/
private logDebug(message: string, data?: unknown): void {
if (this.config.debug) {
console.debug(`[AgentAdapter] ${message}`, data || '');
}
}
}
/**
* Create and initialize an AgentAdapter
*/
export async function createAgentAdapter(
config?: Partial<AgentAdapterConfig>View on GitHub (pinned to fa13ee4ad6)
Solutions
- Await initialize() once before any other call: `await adapter.initialize();` then use the adapter.
- Create the adapter through the factory/helper (e.g. createAgentAdapter) if available, which initializes for you.
- Guard call sites: if (!adapter.isInitialized?.()) await adapter.initialize(); or track an `initialized` boolean in your own wrapper.
- If initialize() itself threw, fix that error first — retrying operations on a half-initialized adapter keeps hitting this guard.
Example fix
// before const adapter = new AgentAdapter(config); await adapter.execute(task); // throws // after const adapter = new AgentAdapter(config); await adapter.initialize(); await adapter.execute(task);
Defensive patterns
Strategy: validation
Validate before calling
const adapter = new AgentAdapter(config); if (!adapter.isInitialized?.()) await adapter.initialize(); // then call operational methods
Type guard
function isReady(a: { isInitialized?: () => boolean }): boolean {
return typeof a.isInitialized === 'function' && a.isInitialized();
} Try / catch
try {
await adapter.execute(input);
} catch (e) {
if ((e as Error).message.includes('not initialized')) {
await adapter.initialize();
return adapter.execute(input); // retry once after init
}
throw e;
} Prevention
- Construct + initialize in one factory function so callers can never see an uninitialized adapter.
- Await initialization in the async DI bootstrap before serving requests.
- Treat a failed initialize() as fatal for that adapter instance.
When it happens
Trigger: Calling adapter.execute/run/register (any guarded method) right after `new AgentAdapter(...)` without awaiting initialize(); calling concurrently with an initialize() that is still in flight; calling after initialize() rejected but the code continued on a rejected-promise path.
Common situations: Missing await in an async setup path (fire-and-forget initialize()); early return from a try block that skips initialization; reusing an adapter instance across requests while an earlier failure left it uninitialized.
Related errors
- ruvLLM bridge not initialized. Call with config first.
- Training system not initialized
- Trajectory buffer not initialized
- Store not initialized. Call initialize() first.
- GuidanceControlPlane not initialized. Call initialize() firs
AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18).
Data as JSON: /api/errors/d1f68bc267b8f894.
Report an issue: GitHub.