mastra-ai/mastra · error
No search configuration available. Provide bm25 or vector co
Error message
No search configuration available. Provide bm25 or vector config.
What it means
The engine was asked to search with no mode specified, so it tried to auto-select one, but neither vector nor BM25 was configured at all. With no index and no embedding pipeline there is nothing to search against, so it throws rather than returning empty results.
Source
Thrown at packages/core/src/workspace/search/search-engine.ts:672
}
if (requestedMode === 'hybrid' && !this.canHybrid) {
throw new Error('Hybrid search requires both vector and BM25 configuration.');
}
return requestedMode;
}
// Auto-determine based on available configuration
if (this.canHybrid) {
return 'hybrid';
}
if (this.canVector) {
return 'vector';
}
if (this.canBM25) {
return 'bm25';
}
throw new Error('No search configuration available. Provide bm25 or vector config.');
}
/**
* Embed a single text, dispatching to the batch path with a one-element array
* when the configured embedder is batch-capable.
*/
async #embedOne(text: string): Promise<number[]> {
if (!this.#vectorConfig) {
throw new Error('Vector configuration is required to embed text.');
}
const { embedder } = this.#vectorConfig;
if (isBatchEmbedder(embedder)) {
const [embedding] = await embedder([text]);
if (!embedding) {
throw new Error('Batch embedder returned no embedding for input text.');
}
return embedding;
}View on GitHub (pinned to 75dd419e61)
Solutions
- Construct the SearchEngine with at least one backend: a `bm25` config for keyword search or a `vectorConfig` (vectorStore + embedder + indexName) for semantic search.
- If search should be optional, check `engine.canBM25 || engine.canVector` before calling search and skip/handle the no-search case.
- Verify your config/env loading actually reaches the SearchEngine constructor (log the options before constructing).
Example fix
// before
const engine = new SearchEngine();
await engine.search('query'); // throws
// after
const engine = new SearchEngine({
bm25: {},
vectorConfig: { vectorStore, embedder, indexName: 'docs' },
});
await engine.search('query'); Defensive patterns
Strategy: validation
Validate before calling
if (!engine.canBM25 && !engine.canVector) {
throw new Error('SearchEngine has no search backend configured; provide bm25 or vectorConfig.');
}
return engine.search(query); Try / catch
try {
results = await engine.search(query);
} catch (e) {
if (e instanceof Error && e.message.includes('No search configuration available')) {
results = []; // or configure a backend and retry
} else {
throw e;
}
} Prevention
- Always construct SearchEngine with at least one backend (bm25 or vectorConfig).
- Assert search config presence in app startup/health checks.
- Log the resolved options before constructing the engine to catch silently dropped config.
When it happens
Trigger: Calling `search(query)` (or `search(query, {})`) on a SearchEngine constructed with neither `vectorConfig` nor a BM25 config — `canVector`, `canBM25`, and `canHybrid` are all false.
Common situations: Instantiating SearchEngine with an empty/omitted options object in a Workspace setup; config loading that silently drops the search options (bad env vars, missing embedder key); code that defers configuring search but already calls search during startup or tests.
Related errors
- BM25 search requires BM25 configuration.
- Hybrid search requires both vector and BM25 configuration.
- Vector search requires vector configuration.
- Vector configuration is required to embed text.
- Workspace does not have search configured
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/1bb74cd7b8523e6f.
Report an issue: GitHub.