mastra-ai/mastra · critical

Observational memory requires @mastra/core support for reque

Error message

Observational memory requires @mastra/core support for request-response-id-rotation. Please bump @mastra/core to a newer version.

What it means

ObservationalMemory depends on a runtime capability of @mastra/core ('request-response-id-rotation') that older core versions lack. The constructor checks coreFeatures and throws at instantiation so incompatibility is caught immediately rather than at runtime mid-conversation.

Source

Thrown at packages/memory/src/processors/observational-memory/observational-memory.ts:463

      releaseLock = resolve;
    });
    this.locks.set(key, lockPromise);

    try {
      return await fn();
    } finally {
      // Release the lock
      releaseLock!();
      // Clean up if this is still our lock
      if (this.locks.get(key) === lockPromise) {
        this.locks.delete(key);
      }
    }
  }

  constructor(config: ObservationalMemoryConfig) {
    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.',
      );
    }

    // Validate that top-level model is not used together with sub-config models
    if (config.model && config.observation?.model) {
      throw new Error(
        'Cannot set both `model` and `observation.model`. Use `model` to set both agents, or set each individually.',
      );
    }
    if (config.model && config.reflection?.model) {
      throw new Error(
        'Cannot set both `model` and `reflection.model`. Use `model` to set both agents, or set each individually.',
      );
    }

    this.shouldObscureThreadIds = config.obscureThreadIds || false;
    this.storage = config.storage;

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Upgrade @mastra/core to the latest version: pnpm update @mastra/core (or the minimum version supporting this feature)
  2. Ensure @mastra/memory and @mastra/core versions are upgraded together in package.json and lockfile
  3. Verify only one @mastra/core copy is installed (check for duplicate versions in the lockfile / dedupe)

Example fix

// before (package.json)
"@mastra/core": "^0.10.0",
"@mastra/memory": "^0.11.0"
// after
"@mastra/core": "^0.11.0",
"@mastra/memory": "^0.11.0"
// then: pnpm install
Defensive patterns

Strategy: validation

Validate before calling

import { coreFeatures } from '@mastra/core';
if (!coreFeatures.has('request-response-id-rotation')) {
  throw new Error('Upgrade @mastra/core before using ObservationalMemory');
}
const mem = new ObservationalMemory(config);

Type guard

function coreSupportsRotation(features: Set<string>): boolean {
  return features.has('request-response-id-rotation');
}

Try / catch

try {
  const mem = new ObservationalMemory(config);
} catch (err) {
  if (err instanceof Error && err.message.includes('request-response-id-rotation')) {
    console.error('Run: pnpm update @mastra/core @mastra/memory');
    process.exit(1);
  } else throw err;
}

Prevention

When it happens

Trigger: Constructing new ObservationalMemory(...) while the installed @mastra/core predates the request-response-id-rotation feature (mismatched package versions).

Common situations: Partial dependency upgrade (bumped @mastra/memory but not @mastra/core); lockfile pinning an old core; monorepo where one package resolves a stale core copy.

Related errors


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