mastra-ai/mastra · error · MastraError

SEMANTIC_RECALL_MISSING_VECTOR_ADAPTER

SEMANTIC_RECALL_MISSING_VECTOR_ADAPTER

Error message

Using Mastra Memory semantic recall requires a vector adapter but no attached adapter was detected.

What it means

Semantic recall performs vector similarity search over stored message embeddings. After confirming storage exists, getInputProcessors checks `this.vector`; if no vector adapter is attached to the Memory instance, this MastraError is thrown. Semantic recall is impossible without a vector store to query.

Source

Thrown at packages/core/src/memory/memory.ts:828

            storage: memoryStore,
            lastMessages: typeof lastMessages === 'number' ? lastMessages : undefined,
          }),
        );
      }
    }

    // Add semantic recall input processor if configured
    if (effectiveConfig.semanticRecall) {
      if (!memoryStore)
        throw new MastraError({
          category: 'USER',
          domain: ErrorDomain.STORAGE,
          id: 'SEMANTIC_RECALL_MISSING_STORAGE_ADAPTER',
          text: 'Using Mastra Memory semantic recall requires a storage adapter but no attached adapter was detected.',
        });

      if (!this.vector)
        throw new MastraError({
          category: 'USER',
          domain: ErrorDomain.MASTRA_VECTOR,
          id: 'SEMANTIC_RECALL_MISSING_VECTOR_ADAPTER',
          text: 'Using Mastra Memory semantic recall requires a vector adapter but no attached adapter was detected.',
        });

      if (!this.embedder)
        throw new MastraError({
          category: 'USER',
          domain: ErrorDomain.MASTRA_VECTOR,
          id: 'SEMANTIC_RECALL_MISSING_EMBEDDER',
          text: 'Using Mastra Memory semantic recall requires an embedder but no attached embedder was detected.',
        });

      // Check if user already manually added SemanticRecall
      const hasSemanticRecall = configuredProcessors.some(p => !isProcessorWorkflow(p) && p.id === 'semantic-recall');

      if (!hasSemanticRecall) {

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Attach a vector adapter: `new Memory({ storage, vector: new PgVector({...}), options: { semanticRecall: {...} } })`.
  2. Use a storage adapter that also provides vector support and pass it as `vector` as well if it implements MastraVector.
  3. Disable semanticRecall if vector search is not required.

Example fix

// before
const memory = new Memory({ storage, options: { semanticRecall: { topK: 5 } } });
// after
const memory = new Memory({
  storage,
  vector: new PgVector({ connectionString: process.env.DATABASE_URL }),
  options: { semanticRecall: { topK: 5 } },
});
Defensive patterns

Strategy: validation

Validate before calling

function assertVectorForSemanticRecall(memory) {
  if (memory.threadConfig?.semanticRecall && !(memory as any).vector) {
    throw new Error('semanticRecall enabled but no vector adapter attached to Memory');
  }
}

Type guard

function hasVector(m): m is MastraMemory & { vector: NonNullable<MastraMemory['vector']> } {
  return Boolean((m as any).vector);
}

Prevention

When it happens

Trigger: Memory configured with `semanticRecall` and a storage adapter but constructed without a `vector` adapter (e.g. `new Memory({ storage, options: { semanticRecall: {...} } })` with no `vector`), then running a generate/stream that builds input processors.

Common situations: Developers assume the storage adapter doubles as a vector store; older Mastra versions resolved vectors from storage, newer versions require an explicit vector adapter; using a storage-only adapter like LibSQL without a vector integration.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/c9df8c073bc26fcc. Report an issue: GitHub.