mastra-ai/mastra · error · Error

Subconscious observation extractor

Error message

Subconscious observation extractor "${name}" shares the Observer model and does not accept model or maxSteps.

What it means

Custom (non-built-in) observation extractor entries share the Observer's model by design, so specifying model or maxSteps on them is rejected. This keeps all observation extraction on one model and prevents silent per-extractor model drift.

Solutions

  1. Remove model and maxSteps from the custom extractor entry.
  2. Set the desired model once on the Observer configuration.
  3. If separate models are essential, run multiple Subconscious processors or a custom pipeline outside this option.

Example fix

// before
{ name: 'facts', model: 'gpt-4o-mini', schema: FactsSchema, onExtracted: save }
// after
{ name: 'facts', schema: FactsSchema, onExtracted: save } // model comes from the Observer
Defensive patterns

Strategy: validation

Validate before calling

const custom = { name: 'facts', model: m, schema: S, onExtracted: f };
if ('model' in custom || 'maxSteps' in custom) throw new Error('custom extractors share the Observer model');

Type guard

function isCustomExtractorEntry(e: object): boolean {
  return !('model' in e) && !('maxSteps' in e);
}

Try / catch

try {
  sub = new Subconscious({ observation: [entry] });
} catch (e) {
  if (e instanceof Error && e.message.includes('shares the Observer model')) {
    const { model: _m, maxSteps: _s, ...rest } = entry as Record<string, unknown>;
    sub = new Subconscious({ observation: [rest] });
  } else throw e;
}

Prevention

When it happens

Trigger: new Subconscious({ observation: [{ name: 'my-extractor', model: m, schema: S, onExtracted: f }] }) — any custom entry containing 'model' or 'maxSteps' keys.

Common situations: Copy-pasting agent config into an extractor entry; assuming each extractor can use its own model; migrating from an older API that allowed per-extractor models.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at packages/memory/src/processors/observational-memory/subconscious/index.ts:214

      return;
    }
    if (BUILT_IN_OBSERVATION.has(name)) {
      if (name === 'capture') {
        if ('model' in entry || 'maxSteps' in entry) {
          throw new Error('Subconscious capture shares the Observer model and does not accept model or maxSteps.');
        }
        if (
          'schema' in entry &&
          entry.schema &&
          (!('onExtracted' in entry) || typeof entry.onExtracted !== 'function')
        ) {
          throw new Error('A custom capture schema requires an onExtracted hook that handles its output.');
        }
      }
      return;
    }
    if ('model' in entry || 'maxSteps' in entry) {
      throw new Error(
        `Subconscious observation extractor "${name}" shares the Observer model and does not accept model or maxSteps.`,
      );
    }
    if (!('schema' in entry) || !entry.schema || !('onExtracted' in entry) || typeof entry.onExtracted !== 'function') {
      throw new Error(`Custom Subconscious observation agent "${name}" requires schema and onExtracted.`);
    }
  }

  #validateReflectionEntry(entry: SubconsciousReflectionEntry): void {
    const name = entryName(entry);
    if (typeof entry === 'string') {
      if (!BUILT_IN_REFLECTION.has(name)) throw new Error(`Unknown Subconscious reflection agent: ${name}`);
      return;
    }
    if (BUILT_IN_REFLECTION.has(name) && 'agent' in entry && entry.agent) {
      throw new Error(`Built-in Subconscious reflection agent "${name}" cannot be replaced with a custom agent.`);
    }
    if (!BUILT_IN_REFLECTION.has(name) && !entry.instructions?.trim() && !('agent' in entry && entry.agent)) {

View on GitHub (pinned to 75dd419e61)