toeverything/AFFiNE · error · SearchProviderNotFound

search_provider_not_found

search_provider_not_found

Error message

Search provider not found.

What it means

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.

Source

Thrown at packages/backend/server/src/plugins/indexer/service.ts:149

    }
    const users = await this.models.user.getPublicUsersMap(userIds);
    for (const doc of docs) {
      doc.createdByUser = users.get(doc.createdByUserId);
      doc.updatedByUser = users.get(doc.updatedByUserId);
    }
    return docs;
  }

  private unwrap<T>(output: SearchOperationOutput, workspaceId: string): T {
    if (output.ok) return output.value as T;
    switch (output.errorCode) {
      case 'workspace_denied':
        throw new SpaceAccessDenied({ spaceId: workspaceId });
      case 'invalid_request':
      case 'unsupported_query':
        throw new InvalidIndexerInput({ reason: output.errorCode });
      case 'provider_unavailable':
        throw new SearchProviderNotFound();
      case 'permission_unavailable':
        throw new WorkspacePermissionNotFound({ spaceId: workspaceId });
      default:
        throw new InternalServerError();
    }
  }
}

View on GitHub (pinned to 591f874dad)

Solutions

  1. Enable and configure a search provider for the indexer plugin in the server configuration
  2. Check indexer plugin startup logs for provider initialization errors and fix the reported cause
  3. If search is optional for your deployment, disable the feature flag / UI entry points so the endpoint is not called
Defensive patterns

Strategy: try-catch

Validate before calling

// feature-gate the search UI on deployment config
if (!config.indexer?.provider) {
  return disableSearchUi();
}
const docs = await indexerService.search(user, { workspaceId, query });

Try / catch

// degrade instead of failing the whole page
try {
  return await indexerService.search(user, { workspaceId, query });
} catch (e) {
  if (e instanceof SearchProviderNotFound) {
    logger.warn('search provider unavailable, serving unindexed fallback');
    return localFallbackSearch(workspaceId, query);
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of toeverything/AFFiNE@591f874dad (2026-08-21). Data as JSON: /api/errors/e243a9135461538f. Report an issue: GitHub.