{"record":{"id":"e90dbde25dd158de","repo":"mastra-ai/mastra","slug":"semantic-recall-requires-a-vector-store-to-be-conf","errorCode":null,"errorMessage":"Semantic recall requires a vector store to be configured.\n\nhttps://mastra.ai/en/docs/memory/semantic-recall","messagePattern":"Semantic recall requires a vector store to be configured\\.\n\nhttps://mastra\\.ai/en/docs/memory/semantic-recall","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/memory/memory.ts","lineNumber":172,"sourceCode":"  })\n\nOr pass memory directly to processor arrays:\n  new Agent({\n    inputProcessors: [memory],\n    outputProcessors: [memory]\n  })\n\nSee: https://mastra.ai/en/docs/memory/processors`,\n      );\n    }\n    if (config.storage) {\n      this._storage = augmentWithInit(config.storage);\n      this._hasOwnStorage = true;\n    }\n\n    if (this.threadConfig.semanticRecall) {\n      if (!config.vector) {\n        throw new Error(\n          `Semantic recall requires a vector store to be configured.\n\nhttps://mastra.ai/en/docs/memory/semantic-recall`,\n        );\n      }\n      this.vector = config.vector;\n\n      if (!config.embedder) {\n        throw new Error(\n          `Semantic recall requires an embedder to be configured.\n\nhttps://mastra.ai/en/docs/memory/semantic-recall`,\n        );\n      }\n\n      // Convert string embedder to ModelRouterEmbeddingModel\n      if (typeof config.embedder === 'string') {\n        this.embedder = new ModelRouterEmbeddingModel(config.embedder);","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/memory/memory.ts#L154-L190","documentation":"Memory's constructor throws when threadConfig.semanticRecall is enabled but no vector store (config.vector) was provided. Semantic recall retrieves relevant past messages via vector similarity, which is impossible without an embedding/vector backend, so Mastra fails fast with a docs link.","triggerScenarios":"new Memory({ storage, options: { semanticRecall: true } }) — or semanticRecall: { topK, messageRange } — without passing a vector store instance as config.vector.","commonSituations":"Enabling semantic recall in options after initially configuring memory without a vector store; setting semanticRecall true via shared config that some deployments build without a vector; forgetting that semanticRecall in thread config implies a mandatory vector dependency.","solutions":["Pass a vector store instance: new Memory({ storage, vector: new MastraVector(...) }) alongside the semanticRecall option.","If semantic recall is not needed, remove the semanticRecall option from the memory/thread config.","Gate the semanticRecall option on vector-store availability in environment-dependent configs.","Configure the vector index/embeddings per the docs at mastra.ai/en/docs/memory/semantic-recall."],"exampleFix":"// before\nnew Memory({ storage, options: { semanticRecall: { topK: 5 } } }); // throws: no vector\n// after\nnew Memory({\n  storage,\n  vector: new MastraVector(new PgVector(process.env.DATABASE_URL)),\n  options: { semanticRecall: { topK: 5 } },\n});","handlingStrategy":"validation","validationCode":"function assertSemanticRecallConfig(config) {\n  const semanticRecall = config.options?.semanticRecall;\n  if (semanticRecall && !config.vector) {\n    throw new Error('semanticRecall is enabled but no vector store was passed (config.vector)');\n  }\n}","typeGuard":"function hasVectorForSemanticRecall(config: MemoryConfig): config is MemoryConfig & { vector: MastraVector } {\n  return !config.options?.semanticRecall || Boolean(config.vector);\n}","tryCatchPattern":"try {\n  const memory = new Memory(config);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('Semantic recall requires a vector store')) {\n    console.warn('semanticRecall disabled: no vector store configured');\n    const memory = new Memory({ ...config, options: { ...config.options, semanticRecall: false } });\n  } else throw e;\n}","preventionTips":["Treat semanticRecall as implying two dependencies: a vector store and configured embeddings.","Disable semanticRecall in environments where no vector backend is available.","Add a config-level assertion test that Memory construction succeeds with your production options."],"tags":["memory","semantic-recall","missing-dependency","configuration"],"backgroundTag":"missing-required-config","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}