mastra-ai/mastra · error

workingMemory.useStateSignals is not supported with workingM

Error message

workingMemory.useStateSignals is not supported with workingMemory.version: 'vnext'. Use stable template working memory or disable useStateSignals.

What it means

The vnext working memory format (markdown working memory version: 'vnext') does not implement useStateSignals, the signal-based state exposure used by the stable template working memory. Memory validates the config combination up front and throws rather than behaving inconsistently at runtime.

Source

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

Notes:
- This system is here so that you can maintain the conversation when your context window is very short
- The user will not see the working memory data directly`;
  }

  private isVNextWorkingMemoryConfig(config?: MemoryConfig): boolean {
    if (!config?.workingMemory) return false;

    const isMDWorkingMemory =
      !(`schema` in config.workingMemory) &&
      (typeof config.workingMemory.template === `string` || config.workingMemory.template) &&
      config.workingMemory;

    return Boolean(isMDWorkingMemory && isMDWorkingMemory.version === `vnext`);
  }

  private assertWorkingMemoryStateSignalsCompatibility(config?: MemoryConfigInternal): void {
    if (config?.workingMemory?.useStateSignals === true && this.isVNextWorkingMemoryConfig(config)) {
      throw new Error(
        "workingMemory.useStateSignals is not supported with workingMemory.version: 'vnext'. Use stable template working memory or disable useStateSignals.",
      );
    }
  }

  private getObservationEmbeddingIndexName(dimensions?: number): string {
    const defaultDimensions = 384;
    const usedDimensions = dimensions ?? defaultDimensions;
    const separator = this.vector?.indexSeparator ?? '_';
    return `${this.observationIndexPrefix}${separator}${usedDimensions}`;
  }

  private async createObservationEmbeddingIndex(dimensions?: number): Promise<{ indexName: string }> {
    const defaultDimensions = 384;
    const usedDimensions = dimensions ?? defaultDimensions;
    const indexName = this.getObservationEmbeddingIndexName(dimensions);

    if (typeof this.vector === `undefined`) {

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Remove useStateSignals: true (or set it false) from the vnext workingMemory config.
  2. If you need useStateSignals, use stable (template) working memory by dropping version: 'vnext'.
  3. Check config-merging code (agent defaults, presets) that might set useStateSignals after your vnext config.

Example fix

// before
workingMemory: { enabled: true, version: 'vnext', useStateSignals: true }
// after (option A)
workingMemory: { enabled: true, version: 'vnext' }
// after (option B — keep signals)
workingMemory: { enabled: true, useStateSignals: true }
Defensive patterns

Strategy: validation

Validate before calling

const wm = config.workingMemory;
if (wm?.useStateSignals === true && wm.version === 'vnext') {
  throw new Error("useStateSignals is incompatible with workingMemory.version 'vnext'");
}

Type guard

function isVNextWithSignals(wm?: { version?: 'vnext' | string; useStateSignals?: boolean }): boolean {
  return wm?.version === 'vnext' && wm.useStateSignals === true;
}

Try / catch

try {
  const memory = new Memory({ storage, options: { workingMemory: wmConfig } });
} catch (e) {
  if (e instanceof Error && e.message.includes('useStateSignals')) {
    wmConfig = { ...wmConfig, useStateSignals: undefined };
  }
  throw e;
}

Prevention

When it happens

Trigger: Configuring workingMemory: { version: 'vnext', useStateSignals: true } (or a config merge that sets useStateSignals true while version is vnext) on a Memory instance.

Common situations: Migrating to vnext markdown working memory while keeping useStateSignals from a previous config; framework/agent defaults injecting useStateSignals: true; copy-pasting configs between vnext and stable setups.

Related errors


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