mastra-ai/mastra · error · HTTPException
Workspace does not have search configured
Error message
Workspace does not have search configured
What it means
The index route (POST /workspaces/:workspaceId/index) throws this 400 when the target workspace has neither BM25 nor vector search enabled (workspace.canBM25 and workspace.canVector are both false). Content can only be indexed if the workspace was configured with at least one search backend.
Solutions
- Configure the workspace with BM25 and/or vector search enabled (per workspace options) before indexing.
- If search is not needed, don't call the index endpoint.
- Verify server-side why canBM25/canVector are false (missing index path, missing embedder/vector store config, env vars).
- Restart/redeploy the server after adding search configuration.
Example fix
// before
new Mastra({ workspaces: { ws1: createWorkspace({ filesystem: fs }) } });
// after
new Mastra({ workspaces: { ws1: createWorkspace({ filesystem: fs, search: { bm25: { enabled: true } } }) } }); Defensive patterns
Strategy: fallback
Validate before calling
// Capability check via the search endpoint's configured workspace
const list = await fetch(`/api/workspaces/${wsId}/search?query=probe`).then(r => r.json());
// or check server config exposes canBM25/canVector before indexing Type guard
function supportsSearch(ws: { canBM25?: boolean; canVector?: boolean }): boolean {
return Boolean(ws.canBM25 || ws.canVector);
} Try / catch
try {
await indexContent(wsId, path, content);
} catch (e) {
if (isHTTPException(e, 400) && /search configured/.test(e.message)) {
// skip indexing or enable BM25/vector in workspace config and redeploy
} else throw e;
} Prevention
- Enable BM25 and/or vector search in workspace options before using index
- Feature-detect search support instead of assuming defaults
- Add an integration test that indexes then searches on a fresh workspace
- Document required search config in deployment checklists
When it happens
Trigger: POSTing content to /workspaces/:id/index on a workspace constructed without a BM25 index directory or vector store; indexing before search backends are initialized; calling index on a filesystem-only workspace.
Common situations: Deploying a workspace config where search options (BM25/vector) were omitted; assuming default search is enabled; environment lacks the index directory or vector DB config so the workspace reports no search capability; stale client docs assuming old defaults.
Related errors
- Workspace filesystem not available
- A session workspace must be a valid Workspace instance.
- Agent model list is not found or empty
- BM25 search requires BM25 configuration.
- CompositeFilesystem requires at least one mount
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/4ecd888b8b3ae9b8.
Report an issue: GitHub.
Appendix: source
Thrown at packages/server/src/server/handlers/workspace.ts:852
summary: 'Index content for search',
description: 'Indexes content for later search operations',
tags: ['Workspace'],
handler: async ({ mastra, path, content, metadata, workspaceId }) => {
try {
requireWorkspaceV1Support();
if (!path || content === undefined) {
throw new HTTPException(400, { message: 'Path and content are required' });
}
const workspace = await getWorkspaceById(mastra, workspaceId);
if (!workspace) {
throw new HTTPException(404, { message: 'No workspace configured' });
}
const canSearch = workspace.canBM25 || workspace.canVector;
if (!canSearch) {
throw new HTTPException(400, { message: 'Workspace does not have search configured' });
}
await workspace.index(path, content, { metadata });
return {
success: true,
path,
};
} catch (error) {
return handleWorkspaceError(error, 'Error indexing content');
}
},
});
// =============================================================================
// Skills Routes (under /workspaces/:workspaceId/skills)
// =============================================================================
View on GitHub (pinned to 75dd419e61)