mastra-ai/mastra · error · Error

The 'processors' option in Memory is deprecated and has been

Error message

The 'processors' option in Memory is deprecated and has been removed.
      
Please use the new Input/Output processor system instead:

OLD (deprecated):
  new Memory({
    processors: [new TokenLimiter(100000)]
  })

NEW (use this):
  new Agent({
    memory,
    outputProcessors: [
      new TokenLimiterProcessor(100000)
    ]
  })

Or pass memory directly to processor arrays:
  new Agent({
    inputProcessors: [memory],
    outputProcessors: [memory]
  })

See: https://mastra.ai/en/docs/memory/processors

What it means

The old Memory constructor option `processors` (e.g. TokenLimiter) has been removed. Passing it now throws immediately with a migration guide instead of silently ignoring the option, because memory-level processors were replaced by the Agent-level Input/Output processor system.

Source

Thrown at packages/core/src/memory/memory.ts:138

  MAX_CONTEXT_TOKENS?: number;

  protected _storage?: MastraCompositeStore;
  vector?: MastraVector;
  embedder?: MastraEmbeddingModel<string>;
  embedderOptions?: MastraEmbeddingOptions;
  protected threadConfig: MemoryConfigInternal = { ...memoryDefaultOptions };
  #mastra?: Mastra;

  constructor(config: { id?: string; name: string } & SharedMemoryConfig) {
    super({ component: 'MEMORY', name: config.name });
    this.id = config.id ?? config.name ?? 'default-memory';

    if (config.options) this.threadConfig = this.getMergedThreadConfig(config.options);

    // DEPRECATION: Block old processors config
    if (config.processors) {
      throw new Error(
        `The 'processors' option in Memory is deprecated and has been removed.
      
Please use the new Input/Output processor system instead:

OLD (deprecated):
  new Memory({
    processors: [new TokenLimiter(100000)]
  })

NEW (use this):
  new Agent({
    memory,
    outputProcessors: [
      new TokenLimiterProcessor(100000)
    ]
  })

Or pass memory directly to processor arrays:

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Remove processors from the Memory config and move them to the Agent as outputProcessors/inputProcessors.
  2. Replace memory memory-processors with their processor-system equivalents (e.g. TokenLimiter -> TokenLimiterProcessor).
  3. Alternatively pass the memory instance itself into the agent's inputProcessors/outputProcessors arrays where supported.
  4. Follow the docs link in the message (mastra.ai/en/docs/memory/processors) for the full migration.

Example fix

// before
new Memory({ storage, processors: [new TokenLimiter(100000)] });
// after
new Agent({
  memory: new Memory({ storage }),
  outputProcessors: [new TokenLimiterProcessor(100000)],
});
Defensive patterns

Strategy: type-guard

Validate before calling

function assertNoLegacyMemoryProcessors(config) {
  if ('processors' in config && config.processors != null) {
    throw new Error("'processors' was removed from Memory; use Agent inputProcessors/outputProcessors");
  }
}

Type guard

type LegacyMemoryConfig = { processors?: unknown };
function usesLegacyProcessors(config: object): config is LegacyMemoryConfig {
  return 'processors' in config && (config as LegacyMemoryConfig).processors != null;
}

Try / catch

try {
  const memory = new Memory(config);
} catch (e) {
  if (e instanceof Error && e.message.includes("'processors' option in Memory is deprecated")) {
    throw new Error('Migrate memory processors to Agent outputProcessors; see mastra.ai/en/docs/memory/processors');
  } throw e;
}

Prevention

When it happens

Trigger: Constructing new Memory({ ..., processors: [tokenLimiter] }) with any truthy processors value in the config.

Common situations: Upgrading from a pre-processor-system Mastra version where Memory accepted processors; following an old tutorial or copied code snippet; type errors previously masked (or using JS) so the stale option survives until runtime.

Related errors


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