{"record":{"id":"1eac8db5c6cfa3c3","repo":"mastra-ai/mastra","slug":"unknown-subconscious-reflection-agent-name","errorCode":null,"errorMessage":"Unknown Subconscious reflection agent: ${name}","messagePattern":"Unknown Subconscious reflection agent: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/memory/src/processors/observational-memory/subconscious/index.ts","lineNumber":226,"sourceCode":"          throw new Error('A custom capture schema requires an onExtracted hook that handles its output.');\n        }\n      }\n      return;\n    }\n    if ('model' in entry || 'maxSteps' in entry) {\n      throw new Error(\n        `Subconscious observation extractor \"${name}\" shares the Observer model and does not accept model or maxSteps.`,\n      );\n    }\n    if (!('schema' in entry) || !entry.schema || !('onExtracted' in entry) || typeof entry.onExtracted !== 'function') {\n      throw new Error(`Custom Subconscious observation agent \"${name}\" requires schema and onExtracted.`);\n    }\n  }\n\n  #validateReflectionEntry(entry: SubconsciousReflectionEntry): void {\n    const name = entryName(entry);\n    if (typeof entry === 'string') {\n      if (!BUILT_IN_REFLECTION.has(name)) throw new Error(`Unknown Subconscious reflection agent: ${name}`);\n      return;\n    }\n    if (BUILT_IN_REFLECTION.has(name) && 'agent' in entry && entry.agent) {\n      throw new Error(`Built-in Subconscious reflection agent \"${name}\" cannot be replaced with a custom agent.`);\n    }\n    if (!BUILT_IN_REFLECTION.has(name) && !entry.instructions?.trim() && !('agent' in entry && entry.agent)) {\n      throw new Error(`Custom Subconscious reflection agent \"${name}\" requires instructions or agent.`);\n    }\n  }\n}\n\nexport {\n  buildSubconsciousActivitySnapshot,\n  publishSubconsciousActivity,\n  publishSubconsciousError,\n  renderSubconsciousActivity,\n  SUBCONSCIOUS_ACTIVITY_STATE_ID,\n} from './activity';","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/memory/src/processors/observational-memory/subconscious/index.ts#L208-L244","documentation":"Reflection entries given as plain strings must name a built-in reflection agent tracked in BUILT_IN_REFLECTION. An unknown string name fails constructor validation immediately, mirroring the observation-side check for reflection.","triggerScenarios":"new Subconscious({ reflection: ['summariez'] }) or any reflection string not present in BUILT_IN_REFLECTION.","commonSituations":"Typo in a built-in reflection name; using an observation-agent name in the reflection list; version mismatch where a documented built-in reflection name does not exist in the installed package.","solutions":["Correct the string to a valid built-in reflection name (see BUILT_IN_REFLECTION in the subconscious module).","Use an object entry ({ instructions: ... } or { agent: ... }) for custom reflection behavior.","Align the installed @mastra/memory version with the docs you followed."],"exampleFix":"// before\nnew Subconscious({ reflection: ['insite'] });\n// after\nnew Subconscious({ reflection: ['insight'] }); // valid built-in, or a custom object entry","handlingStrategy":"validation","validationCode":"const reflection = ['insight'];\nconst bad = reflection.filter(r => typeof r === 'string' && !BUILT_IN_REFLECTION.has(r));\nif (bad.length) throw new Error(`Unknown reflection agents: ${bad.join(', ')}`);","typeGuard":"function isBuiltInReflection(name: string): boolean {\n  return BUILT_IN_REFLECTION.has(name);\n}","tryCatchPattern":"try {\n  sub = new Subconscious({ reflection: names });\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Unknown Subconscious reflection agent')) {\n    console.error(`Invalid reflection entry: ${e.message}`);\n  } else throw e;\n}","preventionTips":["Use the exported built-in reflection name union type.","Keep observation and reflection name lists separate to avoid cross-use.","Construct Subconscious in a unit test with production config.","Diff your names against BUILT_IN_REFLECTION after version upgrades."],"tags":["configuration","validation","observational-memory"],"backgroundTag":"invalid-configuration-value","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}