{"record":{"id":"72f97887966ead9a","repo":"RocketChat/Rocket.Chat","slug":"error-ai-not-enabled","errorCode":"error-ai-not-enabled","errorMessage":"error-ai-not-enabled","messagePattern":"error-ai-not-enabled","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/api/v1/ai-search.ts","lineNumber":360,"sourceCode":"\t\t\tintervalTimeInMS: 60000,\n\t\t},\n\t\tresponse: {\n\t\t\t200: searchAnswerResponseSchema,\n\t\t\t400: validateBadRequestErrorResponse,\n\t\t\t401: validateUnauthorizedErrorResponse,\n\t\t},\n\t},\n\tasync function action() {\n\t\tconst { query, messages } = this.bodyParams;\n\n\t\t// gate before any DB work so users cannot drive message lookups for an unlicensed feature\n\t\tconst aiSearchStatus = await AISearch.status();\n\t\tif (\n\t\t\t!aiSearchStatus.hasIntelligentSearchLicense ||\n\t\t\t!aiSearchStatus.intelligentSearchEnabled ||\n\t\t\t!aiSearchStatus.answerGenerationConfigured\n\t\t) {\n\t\t\tthrow new Meteor.Error('error-ai-not-enabled');\n\t\t}\n\n\t\tconst answerMessages = await getSearchAnswerMessagesForUser(this.userId, messages);\n\t\ttry {\n\t\t\tconst answer = await AISearch.answer({\n\t\t\t\tquery,\n\t\t\t\tmessages: answerMessages,\n\t\t\t});\n\n\t\t\treturn API.v1.success(answer);\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : '';\n\t\t\tif (message === 'error-ai-not-enabled') {\n\t\t\t\tthrow new Meteor.Error('error-ai-not-enabled');\n\t\t\t}\n\t\t\tif (message === 'error-ai-provider-not-configured') {\n\t\t\t\tthrow new Meteor.Error('error-ai-provider-not-configured');\n\t\t\t}","sourceCodeStart":342,"sourceCodeEnd":378,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/api/v1/ai-search.ts#L342-L378","documentation":"Returned by POST ai.search.answer when intelligent search is not fully operational: the workspace lacks the Intelligent Search license, the intelligentSearchEnabled setting is off, or no answer generation provider is configured. The check runs before any message lookup so unlicensed workspaces cannot use the endpoint to probe message data.","triggerScenarios":"POST /api/v1/ai.search.answer on a workspace without an Enterprise license covering intelligent search; with the AI features disabled by the admin; or with the LLM provider for answer generation unset. Also occurs in dev/test environments that never configured AI.","commonSituations":"Trial or Community license without AI entitlement; admin disabled AI after a policy change; provider was configured for embeddings but not for answer generation; environment variables for the AI gateway are missing after a migration.","solutions":["Check the license includes Intelligent Search and is active (Administration > License)","Enable the intelligent search / AI settings in Administration > AI","Configure the answer-generation LLM provider (Administration > AI > answer generation) and verify with GET ai.llm.models","Cache the AISearch.status flags client-side and hide the answer UI when any of the three gates is false"],"exampleFix":"// before\nconst answer = await POST('/api/v1/ai.search.answer', { query, messages });\n\n// after\nconst status = await GET('/api/v1/ai.status'); // hasIntelligentSearchLicense / intelligentSearchEnabled / answerGenerationConfigured\nif (!status.hasIntelligentSearchLicense || !status.intelligentSearchEnabled || !status.answerGenerationConfigured) {\n  throw new Error('AI answers unavailable on this workspace');\n}\nconst answer = await POST('/api/v1/ai.search.answer', { query, messages });","handlingStrategy":"type-guard","validationCode":"const status = await GET('/api/v1/ai.status');\nconst answerReady = status.hasIntelligentSearchLicense && status.intelligentSearchEnabled && status.answerGenerationConfigured;","typeGuard":"const isAnswerGenerationReady = (s: AISearchStatus): boolean =>\n  Boolean(s.hasIntelligentSearchLicense && s.intelligentSearchEnabled && s.answerGenerationConfigured);","tryCatchPattern":"try { /* ai.search.answer */ } catch (e) {\n  if (e.error === 'error-ai-not-enabled') { /* hide answer UI: feature unavailable */ }\n}","preventionTips":["Cache AISearch.status flags and gate the answer UI on them","Check license entitlement before building AI features on Community editions","Surface 'unavailable' messaging instead of retrying a licensing failure"],"tags":["ai-search","licensing","configuration","rocket-chat"],"backgroundTag":"feature-not-licensed","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}