mastra-ai/mastra · error

Observational memory async buffering is enabled by default b

Error message

Observational memory async buffering is enabled by default but the installed version of @mastra/core does not support it. Either upgrade @mastra/core, @mastra/memory, and your storage adapter (@mastra/libsql, @mastra/pg, @mastra/mongodb, or @mastra/convex) to the latest version, or explicitly disable async buffering by setting `observation: { bufferTokens: false }` in your observationalMemory config.

What it means

Observational memory's async token buffering is on by default (unless observation.bufferTokens is explicitly false), and it requires the 'asyncBuffering' capability in @mastra/core. When core lacks that feature, Memory throws, telling you either to upgrade core/memory/storage adapter or to explicitly opt out of buffering.

Source

Thrown at packages/memory/src/index.ts:1928

   * Called lazily by the `omEngine` getter on first access.
   */
  private async _initOMEngine(): Promise<ObservationalMemory | null> {
    const omConfig = normalizeObservationalMemoryConfig(this.threadConfig.observationalMemory);
    if (!omConfig) return null;

    const memoryStore = await this.storage.getStore('memory');
    if (!memoryStore || !memoryStore.supportsObservationalMemory) return null;

    const coreSupportsOM = coreFeatures.has('observationalMemory');
    if (!coreSupportsOM) {
      throw new Error(
        'Observational memory is enabled but the installed version of @mastra/core does not support it. ' +
          'Please upgrade @mastra/core to a version that includes observational memory support.',
      );
    }

    if (omConfig.observation?.bufferTokens !== false && !coreFeatures.has('asyncBuffering')) {
      throw new Error(
        'Observational memory async buffering is enabled by default but the installed version of @mastra/core does not support it. ' +
          'Either upgrade @mastra/core, @mastra/memory, and your storage adapter (@mastra/libsql, @mastra/pg, @mastra/mongodb, or @mastra/convex) to the latest version, ' +
          'or explicitly disable async buffering by setting `observation: { bufferTokens: false }` in your observationalMemory config.',
      );
    }

    if (!coreFeatures.has('request-response-id-rotation')) {
      throw new Error(
        'Observational memory requires @mastra/core support for request-response-id-rotation. Please bump @mastra/core to a newer version.',
      );
    }

    if (omConfig.experimental_subconscious) {
      await this.getKnowledgeStore();
    }

    const { ObservationalMemory: OMClass } = await import('./processors/observational-memory');

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Upgrade @mastra/core, @mastra/memory, and your storage adapter (@mastra/libsql, @mastra/pg, @mastra/mongodb, or @mastra/convex) to the latest versions.
  2. Or disable buffering explicitly: observation: { bufferTokens: false } inside the observationalMemory config.
  3. Verify installed versions with pnpm list @mastra/core @mastra/memory to catch lockfile drift.

Example fix

// before
observationalMemory: { enabled: true }
// after (if not upgrading)
observationalMemory: { enabled: true, observation: { bufferTokens: false } }
Defensive patterns

Strategy: validation

Validate before calling

import { features } from '@mastra/core';
const om = memoryConfig.observationalMemory;
if (om?.enabled && om.observation?.bufferTokens !== false && !features.has('asyncBuffering')) {
  throw new Error('Upgrade the mastra stack or set observation.bufferTokens: false');
}

Type guard

function asyncBufferingCompatible(omConfig: { observation?: { bufferTokens?: number | false } }, coreFeatures: Set<string>): boolean {
  return omConfig.observation?.bufferTokens === false || coreFeatures.has('asyncBuffering');
}

Try / catch

try {
  await initMemory();
} catch (e) {
  if (e instanceof Error && e.message.includes('async buffering')) {
    logger.error('Either upgrade @mastra/core/@mastra/memory/storage adapter or set observation.bufferTokens: false.');
  }
  throw e;
}

Prevention

When it happens

Trigger: Enabling observationalMemory with an @mastra/core version that has 'observationalMemory' but not 'asyncBuffering', and not setting observation.bufferTokens: false.

Common situations: Partially upgraded stacks where core is new enough for OM but storage adapters (libsql/pg/mongodb/convex) or core lag behind the asyncBuffering feature; following docs on newer versions while running older installed packages.

Related errors


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