{"record":{"id":"f1c6e21251f21d51","repo":"mastra-ai/mastra","slug":"subconscious-requires-a-knowledge-storage-domain","errorCode":null,"errorMessage":"Subconscious requires a knowledge storage domain. Configure a storage adapter that provides stores.knowledge.","messagePattern":"Subconscious requires a knowledge storage domain\\. Configure a storage adapter that provides stores\\.knowledge\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/memory/src/processors/observational-memory/subconscious/capture.ts","lineNumber":96,"sourceCode":"    throw new Error(\n      'Subconscious requires requestContext.organizationId to derive scoped knowledge. Set organizationId on the request context for this conversation.',\n    );\n  }\n  const resourceId = resolveKnowledgeResourceId(context.requestContext, context.resourceId);\n  if (!resourceId) {\n    throw new Error('Subconscious requires resourceId to derive scoped knowledge.');\n  }\n  if (!context.threadId) {\n    throw new Error('Subconscious requires threadId to derive scoped knowledge.');\n  }\n  return [`org:${organizationId}`, `resource:${resourceId}`, `thread:${context.threadId}`];\n}\n\nasync function getKnowledgeStore(context: ExtractorRuntimeContext): Promise<KnowledgeStorage> {\n  if (!context.memory) throw new Error('Subconscious capture requires an active Memory instance.');\n  const store = await context.memory.storage.getStore('knowledge');\n  if (!store) {\n    throw new Error(\n      'Subconscious requires a knowledge storage domain. Configure a storage adapter that provides stores.knowledge.',\n    );\n  }\n  return store;\n}\n\nfunction parseWhen(value: string | undefined): Date | undefined {\n  if (!value) return undefined;\n  const when = new Date(value);\n  if (Number.isNaN(when.getTime())) throw new Error(`Invalid Subconscious record time: ${value}`);\n  return when;\n}\n\nexport interface CaptureExtractorOptions {\n  config?: SubconsciousCaptureConfig;\n  defaultScope: KnowledgeScopeLevel;\n  maxScope?: KnowledgeScopeLevel;\n  learnedGuidance: boolean;","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/memory/src/processors/observational-memory/subconscious/capture.ts#L78-L114","documentation":"After obtaining a Memory instance, capture requires the storage adapter to expose a 'knowledge' store via memory.storage.getStore('knowledge'). If the adapter doesn't implement the knowledge domain, capture throws because there is nowhere to persist knowledge records.","triggerScenarios":"Using a storage adapter that lacks the knowledge store (older/custom adapters) while Subconscious capture is enabled; adapter not migrated to support stores.knowledge.","commonSituations":"Upgrading @mastra/core memory processors without upgrading the storage package/version; custom storage adapters; libsql/pg adapters built before the knowledge domain existed.","solutions":["Upgrade the storage adapter package to a version supporting the knowledge store (e.g. latest @mastra/libsql / @mastra/pg)","Switch to a storage adapter that implements stores.knowledge","Disable Subconscious capture if your storage backend can't support knowledge storage","Implement getStore('knowledge') in custom adapters"],"exampleFix":"// before\nstorage: new LibSQLStore({ url: 'file:old.db' }) // pre-knowledge-domain version\n// after\npnpm add @mastra/libsql@latest\nstorage: new LibSQLStore({ url: 'file:mastra.db' })","handlingStrategy":"validation","validationCode":"const store = await memory.storage.getStore('knowledge'); if (!store) throw new Error('Storage adapter lacks knowledge domain');","typeGuard":"const supportsKnowledge = async (m: Memory) => !!(await m.storage.getStore('knowledge'));","tryCatchPattern":"try { await capture(ctx) } catch (e) { if (String(e).includes('knowledge storage domain')) { upgradeStorageOrDisable(); } else throw e; }","preventionTips":["Verify adapter supports stores.knowledge before enabling Subconscious","Keep storage adapter packages on latest versions","Add a startup health check for required storage domains"],"tags":["storage","subconscious","configuration","compatibility"],"backgroundTag":"unsupported-storage-adapter","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}