{"record":{"id":"f04a3e5802fbab0a","repo":"mastra-ai/mastra","slug":"tried-to-create-observation-embedding-index-but-no","errorCode":null,"errorMessage":"Tried to create observation embedding index but no vector db is attached to this Memory instance.","messagePattern":"Tried to create observation embedding index but no vector db is attached to this Memory instance\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/memory/src/index.ts","lineNumber":2194,"sourceCode":"        \"workingMemory.useStateSignals is not supported with workingMemory.version: 'vnext'. Use stable template working memory or disable useStateSignals.\",\n      );\n    }\n  }\n\n  private getObservationEmbeddingIndexName(dimensions?: number): string {\n    const defaultDimensions = 384;\n    const usedDimensions = dimensions ?? defaultDimensions;\n    const separator = this.vector?.indexSeparator ?? '_';\n    return `${this.observationIndexPrefix}${separator}${usedDimensions}`;\n  }\n\n  private async createObservationEmbeddingIndex(dimensions?: number): Promise<{ indexName: string }> {\n    const defaultDimensions = 384;\n    const usedDimensions = dimensions ?? defaultDimensions;\n    const indexName = this.getObservationEmbeddingIndexName(dimensions);\n\n    if (typeof this.vector === `undefined`) {\n      throw new Error(\n        `Tried to create observation embedding index but no vector db is attached to this Memory instance.`,\n      );\n    }\n\n    await this.vector.createIndex({\n      indexName,\n      dimension: usedDimensions,\n    } as any);\n\n    return { indexName };\n  }\n\n  /**\n   * Search observation groups across threads by semantic similarity.\n   * Requires a vector store and embedder to be configured.\n   */\n  public async searchMessages({\n    query,","sourceCodeStart":2176,"sourceCodeEnd":2212,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/memory/src/index.ts#L2176-L2212","documentation":"createObservationEmbeddingIndex creates a vector index for observational memory embeddings; it requires a vector store attached to the Memory instance. If this.vector is undefined it throws before calling vector.createIndex, since there is no target to create the index in.","triggerScenarios":"Enabling observationalMemory with embedding-dependent features (e.g. observation embeddings / experimental subconscious) on a Memory configured without a vector store.","commonSituations":"Adding observationalMemory to an existing Memory({ storage, embedder }) setup that never needed a vector DB; forgetting that OM observation embeddings require vector storage even if chat-level semantic recall is off.","solutions":["Attach a vector store to Memory: new Memory({ storage, embedder, vector: new LibSQLVector(...) }) or equivalent (PgVector, etc.).","Disable the observational memory features that require embeddings if a vector store is not desired.","Confirm your config builder passes the vector option through to the Memory constructor."],"exampleFix":"// before\nconst memory = new Memory({ storage, options: { observationalMemory: { enabled: true } } });\n// after\nimport { LibSQLVector } from '@mastra/libsql';\nconst memory = new Memory({ storage, vector: new LibSQLVector({ connectionUrl: 'file:./vectors.db' }), options: { observationalMemory: { enabled: true } } });","handlingStrategy":"validation","validationCode":"if (memoryConfig.observationalMemory?.enabled && !memoryConfig.vector) {\n  throw new Error('Observational memory embedding index requires a vector store on Memory');\n}","typeGuard":"function hasVector(m: Memory): boolean {\n  return typeof (m as unknown as { vector?: unknown }).vector !== 'undefined';\n}","tryCatchPattern":"try {\n  await memory.getObservationalMemory();\n} catch (e) {\n  if (e instanceof Error && e.message.includes('no vector db is attached')) {\n    console.error('Attach a vector store (e.g. LibSQLVector) to the Memory instance.');\n  }\n  throw e;\n}","preventionTips":["Attach a vector store whenever observationalMemory is enabled.","Use one Memory factory enforcing required option combinations (storage, embedder, vector).","Document in your setup that OM observation embeddings need vector storage independent of chat semantic recall."],"tags":["memory","observational-memory","vector-store","configuration"],"backgroundTag":"missing-vector-store","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}