{"record":{"id":"449189f0dec94b97","repo":"RocketChat/Rocket.Chat","slug":"ai-search-request-failed","errorCode":null,"errorMessage":"AI search request failed","messagePattern":"AI search request failed","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"apps/meteor/server/api/v1/ai-search.ts","lineNumber":289,"sourceCode":"\t\t\taiSearchStatus.intelligentSearchConfigured\n\t\t) {\n\t\t\ttry {\n\t\t\t\tintelligentResults = await AISearch.search({\n\t\t\t\t\tquery,\n\t\t\t\t\tuserId: this.userId,\n\t\t\t\t\tfilters: {\n\t\t\t\t\t\trid,\n\t\t\t\t\t\trids,\n\t\t\t\t\t\troomNames,\n\t\t\t\t\t\tfromUsername,\n\t\t\t\t\t\tfromUsernames,\n\t\t\t\t\t\tstartDate: startDate?.toISOString(),\n\t\t\t\t\t\tendDate: endDate?.toISOString(),\n\t\t\t\t\t},\n\t\t\t\t\tlimit: intelligentLimit,\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tthis.logger.warn({ msg: 'AI search request failed', err: error });\n\t\t\t\tintelligentResults = [];\n\t\t\t}\n\t\t}\n\n\t\treturn API.v1.success({\n\t\t\tintelligent: intelligentResults,\n\t\t\tmeta: {\n\t\t\t\tintelligentSearchEnabled: aiSearchStatus.intelligentSearchEnabled,\n\t\t\t\tintelligentSearchConfigured: aiSearchStatus.intelligentSearchConfigured,\n\t\t\t\tanswerGenerationConfigured: aiSearchStatus.answerGenerationConfigured,\n\t\t\t},\n\t\t});\n\t},\n);\n\nAPI.v1.get(\n\t'ai.llm.models',\n\t{","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/api/v1/ai-search.ts#L271-L307","documentation":"After AISearch.status() reported intelligent search available, the actual intelligent-search request itself threw. The endpoint logs this warning, resets intelligentResults to an empty array, and still returns HTTP success with the non-intelligent results plus meta flags — so the AI portion fails silently for the caller unless it checks the intelligent array and meta fields.","triggerScenarios":"The search pipeline (OpenSearch/vector store) erroring on this specific query: missing or rebuilding index, embedding/LLM provider returning 4xx/5xx or timing out, invalid combinations of filters (rid/roomNames/fromUsername/date ranges) the backend rejects, or result size beyond limits.","commonSituations":"OpenSearch index being reindexed; AI provider API key expired or rate-limited; very wide date ranges or many rooms making the query slow enough to hit timeouts; status() passing but the query path misconfigured.","solutions":["Read the err from the log entry — it distinguishes provider auth/rate-limit errors from OpenSearch/index errors","Check AI provider credentials and quota if the error is 401/429 from the provider","Check search backend health and that the workspace index exists and is not mid-rebuild","Narrow the query (fewer rooms, smaller date window) to rule out timeouts","In clients, treat an empty intelligent array as degraded output instead of 'no results'"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// server-side guard: only call the intelligent pipeline when status is green\nif (!aiSearchStatus.hasIntelligentSearchLicense || !aiSearchStatus.intelligentSearchEnabled || !aiSearchStatus.intelligentSearchConfigured) {\n\treturn API.v1.success({ intelligent: [], meta: { ...aiSearchStatus } });\n}","typeGuard":null,"tryCatchPattern":"let intelligentResults: AISearchResult[] = [];\ntry {\n\tintelligentResults = await runIntelligentSearch(query, { limit: intelligentLimit });\n} catch (error) {\n\tthis.logger.warn({ msg: 'AI search request failed', err: error });\n\tintelligentResults = []; // degrade to normal search, still return success\n}","preventionTips":["Monitor and alert on the warn's err field to catch expired AI provider keys before users notice","Keep the search index healthy; reindex during maintenance windows","Include the meta flags in client telemetry so silent degradation is measurable"],"tags":["search","ai","graceful-degradation","timeout","rest-api"],"backgroundTag":"search-query-failed","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}