{"record":{"id":"4ecd888b8b3ae9b8","repo":"mastra-ai/mastra","slug":"workspace-does-not-have-search-configured","errorCode":null,"errorMessage":"Workspace does not have search configured","messagePattern":"Workspace does not have search configured","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"packages/server/src/server/handlers/workspace.ts","lineNumber":852,"sourceCode":"  summary: 'Index content for search',\n  description: 'Indexes content for later search operations',\n  tags: ['Workspace'],\n  handler: async ({ mastra, path, content, metadata, workspaceId }) => {\n    try {\n      requireWorkspaceV1Support();\n\n      if (!path || content === undefined) {\n        throw new HTTPException(400, { message: 'Path and content are required' });\n      }\n\n      const workspace = await getWorkspaceById(mastra, workspaceId);\n      if (!workspace) {\n        throw new HTTPException(404, { message: 'No workspace configured' });\n      }\n\n      const canSearch = workspace.canBM25 || workspace.canVector;\n      if (!canSearch) {\n        throw new HTTPException(400, { message: 'Workspace does not have search configured' });\n      }\n\n      await workspace.index(path, content, { metadata });\n\n      return {\n        success: true,\n        path,\n      };\n    } catch (error) {\n      return handleWorkspaceError(error, 'Error indexing content');\n    }\n  },\n});\n\n// =============================================================================\n// Skills Routes (under /workspaces/:workspaceId/skills)\n// =============================================================================\n","sourceCodeStart":834,"sourceCodeEnd":870,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/workspace.ts#L834-L870","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nnew Mastra({ workspaces: { ws1: createWorkspace({ filesystem: fs }) } });\n// after\nnew Mastra({ workspaces: { ws1: createWorkspace({ filesystem: fs, search: { bm25: { enabled: true } } }) } });","handlingStrategy":"fallback","validationCode":"// Capability check via the search endpoint's configured workspace\nconst list = await fetch(`/api/workspaces/${wsId}/search?query=probe`).then(r => r.json());\n// or check server config exposes canBM25/canVector before indexing","typeGuard":"function supportsSearch(ws: { canBM25?: boolean; canVector?: boolean }): boolean {\n  return Boolean(ws.canBM25 || ws.canVector);\n}","tryCatchPattern":"try {\n  await indexContent(wsId, path, content);\n} catch (e) {\n  if (isHTTPException(e, 400) && /search configured/.test(e.message)) {\n    // skip indexing or enable BM25/vector in workspace config and redeploy\n  } else throw e;\n}","preventionTips":["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"],"tags":["http-400","search","workspace","configuration"],"backgroundTag":"feature-not-configured","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}