{"record":{"id":"e243a9135461538f","repo":"toeverything/AFFiNE","slug":"search-provider-not-found","errorCode":"search_provider_not_found","errorMessage":"Search provider not found.","messagePattern":"Search provider not found\\.","errorType":"exception","errorClass":"SearchProviderNotFound","httpStatus":404,"severity":"error","filePath":"packages/backend/server/src/plugins/indexer/service.ts","lineNumber":149,"sourceCode":"    }\n    const users = await this.models.user.getPublicUsersMap(userIds);\n    for (const doc of docs) {\n      doc.createdByUser = users.get(doc.createdByUserId);\n      doc.updatedByUser = users.get(doc.updatedByUserId);\n    }\n    return docs;\n  }\n\n  private unwrap<T>(output: SearchOperationOutput, workspaceId: string): T {\n    if (output.ok) return output.value as T;\n    switch (output.errorCode) {\n      case 'workspace_denied':\n        throw new SpaceAccessDenied({ spaceId: workspaceId });\n      case 'invalid_request':\n      case 'unsupported_query':\n        throw new InvalidIndexerInput({ reason: output.errorCode });\n      case 'provider_unavailable':\n        throw new SearchProviderNotFound();\n      case 'permission_unavailable':\n        throw new WorkspacePermissionNotFound({ spaceId: workspaceId });\n      default:\n        throw new InternalServerError();\n    }\n  }\n}\n","sourceCodeStart":131,"sourceCodeEnd":157,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/591f874dad30887a80143a061a44bd3ca7ee3299/packages/backend/server/src/plugins/indexer/service.ts#L131-L157","documentation":"unwrap maps a search-operation errorCode of 'provider_unavailable' to SearchProviderNotFound (gateway for the search backend): no search provider could serve the operation — none is configured/enabled for this deployment, or the provider failed to initialize.","triggerScenarios":"Any indexer search call on a deployment where the search backend is not configured or not running; provider startup failure also surfaces here on every query.","commonSituations":"Self-hosted deployments that enabled the indexer plugin without configuring a search provider; provider process crashed or was never started; config keys for the search backend missing in the environment.","solutions":["Enable and configure a search provider for the indexer plugin in the server configuration","Check indexer plugin startup logs for provider initialization errors and fix the reported cause","If search is optional for your deployment, disable the feature flag / UI entry points so the endpoint is not called"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// feature-gate the search UI on deployment config\nif (!config.indexer?.provider) {\n  return disableSearchUi();\n}\nconst docs = await indexerService.search(user, { workspaceId, query });","typeGuard":null,"tryCatchPattern":"// degrade instead of failing the whole page\ntry {\n  return await indexerService.search(user, { workspaceId, query });\n} catch (e) {\n  if (e instanceof SearchProviderNotFound) {\n    logger.warn('search provider unavailable, serving unindexed fallback');\n    return localFallbackSearch(workspaceId, query);\n  }\n  throw e;\n}","preventionTips":["Health-check the search provider at startup and expose it in /status so clients can gate on it","Verify self-hosted configs include the search provider before enabling search features","Treat SearchProviderNotFound as permanent for that deployment — do not retry the same call"],"tags":["indexer","search","provider","configuration","self-hosted"],"backgroundTag":"search-provider-unavailable","analyzedSha":"591f874dad30887a80143a061a44bd3ca7ee3299","analyzedAt":"2026-08-21T18:20:45.039Z","contentChangedAt":"2026-08-21T18:20:45.039Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}