mastra-ai/mastra · error · HTTPException

Observational Memory processor not available

Error message

Observational Memory processor not available

What it means

OM is enabled, but agent.resolveProcessorById('observational-memory') returned nothing, or the resolved processor lacks a waitForBuffering method. The handler needs this processor to block until in-flight OM buffering finishes; without it the route cannot proceed.

Source

Thrown at packages/server/src/server/handlers/memory.ts:787

            if (!record || (!record.isBufferingObservation && !record.isBufferingReflection)) {
              break;
            }
            await new Promise(resolve => setTimeout(resolve, pollIntervalMs));
          }
          return { record };
        }
        return { record: null };
      }

      const omConfig = await getOMConfigFromAgent(agent, requestContext);
      if (!omConfig?.enabled) {
        throw new HTTPException(400, { message: 'Observational Memory is not enabled for this agent' });
      }

      // Resolve the OM processor to call waitForBuffering
      const omProcessor = await agent.resolveProcessorById('observational-memory', requestContext);
      if (!omProcessor || typeof (omProcessor as any).waitForBuffering !== 'function') {
        throw new HTTPException(400, { message: 'Observational Memory processor not available' });
      }

      // Block until buffering completes (30s timeout)
      await (omProcessor as any).waitForBuffering(threadId, resourceId);

      // After buffering, fetch the updated record
      const memory = await getMemoryFromContext({ mastra, agentId, requestContext });
      if (!memory) {
        throw new HTTPException(400, { message: 'Memory is not configured for this agent' });
      }

      let memoryStore: MemoryStorage | undefined;
      try {
        memoryStore = await memory.storage.getStore('memory');
      } catch {
        throw new HTTPException(400, { message: 'Memory storage is not initialized' });
      }
      if (!memoryStore) {

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Upgrade @mastra/core, @mastra/server and memory packages to aligned versions so the built-in observational-memory processor registers automatically.
  2. Ensure the OM processor is included in the agent's processor list when configuring processors manually.
  3. Verify the resolved processor implements waitForBuffering; if using a custom OM implementation, add that method.
  4. Catch the 400 client-side and fall back to fetching the record directly via GET observational-memory.

Example fix

// before
new Agent({ name: 'a', instructions: '...', memory, processors: [myCustomProcessor] });
// after
new Agent({ name: 'a', instructions: '...', memory, processors: [myCustomProcessor, new ObservationalMemoryProcessor({ scope: 'resource' })] });
Defensive patterns

Strategy: fallback

Validate before calling

// server-side sanity: confirm the processor resolves before exposing the route to clients
const proc = await agent.resolveProcessorById('observational-memory', requestContext);
if (typeof (proc as any)?.waitForBuffering !== 'function') {
  console.warn('OM processor missing waitForBuffering; check package versions');
}

Type guard

function hasWaitForBuffering(p: unknown): p is { waitForBuffering(threadId?: string, resourceId?: string): Promise<void> } {
  return !!p && typeof (p as any).waitForBuffering === 'function';
}

Try / catch

try {
  return await waitForBuffering(agentId, threadId, resourceId);
} catch (e) {
  if (isHttpError(e, 400) && /processor not available/.test(e.message)) {
    // degrade: fetch current record directly instead of waiting
    return fetchObservationalMemory(agentId, resourceId, threadId);
  }
  throw e;
}

Prevention

When it happens

Trigger: Agent configured with OM enabled but the observational-memory processor was not registered on the agent (config shape changed between versions), a custom processor list replaced it, or the installed @mastra/core version's processor interface no longer exposes waitForBuffering.

Common situations: Version drift: server and core packages upgraded independently so the processor id or API changed; agents built via stored/builder configs that persist an OM flag but not the processor; custom processors array omitting the built-in OM processor.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/0e0ae0d340fcde51. Report an issue: GitHub.