ruvnet/ruflo · error
AgentDB not initialized
Error message
AgentDB not initialized
What it means
The built-in vector store (AgentDB shim inside the integration) guards store() with an initialized flag that only initialize() sets and shutdown() clears. store() is the first check it performs, before dimension validation, so this error always means lifecycle ordering, not bad data.
Source
Thrown at v3/@claude-flow/plugins/src/integrations/agentic-flow.ts:571
this.initialized = true;
}
/**
* Shutdown AgentDB.
*/
async shutdown(): Promise<void> {
if (!this.initialized) return;
this.vectors.clear();
this.initialized = false;
}
/**
* Store a vector.
*/
async store(id: string, vector: Float32Array, metadata?: Record<string, unknown>): Promise<void> {
if (!this.initialized) {
throw new Error('AgentDB not initialized');
}
if (vector.length !== this.config.dimensions) {
throw new Error(`Vector dimension mismatch: expected ${this.config.dimensions}, got ${vector.length}`);
}
const entry: VectorEntry = {
id,
vector,
metadata,
timestamp: new Date(),
};
this.vectors.set(id, entry);
this.emit(AGENTIC_FLOW_EVENTS.MEMORY_STORED, {
id,
timestamp: new Date(),View on GitHub (pinned to fa13ee4ad6)
Solutions
- await vectorStore.initialize(config) before any store call
- Store the init promise and await it at every entry point (seed function, request handler) rather than calling initialize() multiple times
- After shutdown(), re-initialize before storing again
Example fix
// before
db.initialize({ dimensions: 1536 }); // not awaited
await db.store('v1', vec); // Error: AgentDB not initialized
// after
const ready = db.initialize({ dimensions: 1536 });
await ready;
await db.store('v1', vec); Defensive patterns
Strategy: validation
Validate before calling
const dbReady = db.initialize({ dimensions: 1536 }); // one awaited promise
async function put(id: string, vec: Float32Array): Promise<void> {
await dbReady;
await db.store(id, vec);
} Prevention
- Await initialize() before any store; share the ready promise across call sites
- Do not fire-and-forget init in one function and store in another
- After shutdown(), re-initialize before further writes
When it happens
Trigger: store() before await initialize({...}) resolves; init fired without await so a subsequent store races it; storing after shutdown() cleared the flag; init failed (e.g. bad config) and the failure was swallowed before store was attempted.
Common situations: Plugin onInitialize seeding embeddings before awaiting DB init; fire-and-forget init calls; restart flows that reuse a store instance after shutdown.
Related errors
- Swarm not initialized
- Vector dimension mismatch: expected ${this.config.dimensions
- Vector dimensions must match
- embedding failed
- each record requires a non-empty numeric vector
AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18).
Data as JSON: /api/errors/46ec48f7daeb4fc9.
Report an issue: GitHub.