{"record":{"id":"f4b9192da593764e","repo":"mastra-ai/mastra","slug":"knowledge-write-tools-require-a-configured-knowled","errorCode":null,"errorMessage":"Knowledge write tools require a configured knowledge storage domain.","messagePattern":"Knowledge write tools require a configured knowledge storage domain\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/memory/src/processors/observational-memory/subconscious/knowledge-write-tools.ts","lineNumber":32,"sourceCode":"const MAX_GUIDANCE_LENGTH = 4_000;\nconst scopeLevelSchema: JSONSchema7 = { type: 'string', enum: ['org', 'resource', 'thread'] };\n\ntype KnowledgeWriteToolsMemory = {\n  storage: {\n    getStore(name: 'knowledge'): Promise<KnowledgeStorage | undefined>;\n  };\n};\n\nexport interface KnowledgeWriteToolsOptions {\n  scope: KnowledgeScope;\n  sourceThreadId: string;\n  defaultScope: KnowledgeScopeLevel;\n  maxScope?: KnowledgeScopeLevel;\n}\n\nasync function getStore(memory: KnowledgeWriteToolsMemory): Promise<KnowledgeStorage> {\n  const store = await memory.storage.getStore('knowledge');\n  if (!store) throw new Error('Knowledge write tools require a configured knowledge storage domain.');\n  return store;\n}\n\nfunction resolveWriteScope(options: KnowledgeWriteToolsOptions, level?: KnowledgeScopeLevel): KnowledgeScope {\n  const scope = expandKnowledgeScope(options.scope, level ?? options.defaultScope);\n  assertKnowledgeScopeWithinCeiling(scope, options.maxScope);\n  return scope;\n}\n\nfunction requireVisible(scope: KnowledgeScope, options: KnowledgeWriteToolsOptions, label: string): void {\n  if (!isKnowledgeScopeVisible(scope, options.scope)) {\n    throw new Error(`${label} is outside the curator's visible scope.`);\n  }\n}\n\nexport function createKnowledgeWriteTools(\n  memory: KnowledgeWriteToolsMemory,\n  options: KnowledgeWriteToolsOptions,","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/memory/src/processors/observational-memory/subconscious/knowledge-write-tools.ts#L14-L50","documentation":"The knowledge write tools (knowledge_append, knowledge_remove, knowledge_update_node, knowledge_merge_nodes, knowledge_rescope, knowledge_write_node_*) all fetch the 'knowledge' storage domain via memory.storage.getStore('knowledge') before performing any mutation. When that named store is not configured, getStore throws this write-tool variant of the missing-storage-domain error to protect against unbacked mutations.","triggerScenarios":"Invoking any curator write tool produced by createKnowledgeWriteTools when the memory/storage instance lacks a registered 'knowledge' store.","commonSituations":"Storage adapter without named-store support; fresh deployments where the knowledge domain was never provisioned; pointing curator agents at a storage instance separate from the one where the knowledge domain is configured.","solutions":["Register and provision the 'knowledge' storage domain on the storage instance passed to createKnowledgeWriteTools.","Run storage setup/migrations so getStore('knowledge') returns a store.","Use the same storage instance for memory and curator tools — not two differently configured adapters.","Pre-flight check: await memory.storage.getStore('knowledge') before enabling curator tools."],"exampleFix":"// before\nconst curatorTools = createKnowledgeWriteTools({ storage: messageOnlyStorage }, options);\n// after\nconst curatorTools = createKnowledgeWriteTools({ storage: storageWithKnowledgeDomain }, options);","handlingStrategy":"validation","validationCode":"const store = await memory.storage.getStore('knowledge');\nif (!store) throw new Error('Curator write tools disabled: knowledge storage domain not configured.');\nconst tools = createKnowledgeWriteTools(memory, options);","typeGuard":"async function isCuratorStorageReady(memory: { storage: { getStore(n: 'knowledge'): Promise<unknown> } }): Promise<boolean> {\n  return (await memory.storage.getStore('knowledge')) !== undefined;\n}","tryCatchPattern":"try {\n  return await curatorTools.knowledge_append.execute(args, {} as any);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('configured knowledge storage domain')) {\n    return { success: false, reason: 'knowledge-store-missing' };\n  }\n  throw e;\n}","preventionTips":["Provision the knowledge domain before creating curator agents.","Share one storage instance across memory and curator tooling.","Run storage migrations as part of deployment.","Gate curator agent startup on a getStore('knowledge') check."],"tags":["knowledge-write-tools","storage-configuration","missing-store","mastra-memory"],"backgroundTag":"missing-storage-domain","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}