{"record":{"id":"c9d70c4c85d77546","repo":"RocketChat/Rocket.Chat","slug":"error-ai-not-enabled-c9d70c","errorCode":null,"errorMessage":"error-ai-not-enabled","messagePattern":"error-ai-not-enabled","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/services/ai-search/service.ts","lineNumber":390,"sourceCode":"\t\t\tpipelineFilters,\n\t\t\tlimit,\n\t\t\tfetch: fetchWithSsrfValidation,\n\t\t\tlogger,\n\t\t});\n\n\t\treturn this.normalizeIntelligentResults(json, userId, limit);\n\t}\n\n\tasync answer({ query, messages }: { query: string; messages: AISearchAnswerMessage[] }): Promise<AISearchAnswerResult> {\n\t\tconst hasIntelligentSearchLicense = await License.hasModule(AI_LICENSE_MODULE);\n\t\tconst intelligentSearchEnabled = settings.get<boolean>('AI_Intelligent_Search_Enabled');\n\t\tconst answerGenerationEnabled = settings.get<boolean>('AI_Intelligent_Search_Answer_Enabled');\n\t\tconst pipelineConfig = this.getPipelineConfig();\n\t\tconst provider = this.getAnswerProviderConfig();\n\t\tconst systemPromptSetting = settings.get<string>('AI_Intelligent_Search_Answer_System_Prompt');\n\n\t\tif (!hasIntelligentSearchLicense || intelligentSearchEnabled !== true || answerGenerationEnabled !== true || !pipelineConfig) {\n\t\t\tthrow new Error('error-ai-not-enabled');\n\t\t}\n\n\t\tif (!provider) {\n\t\t\tthrow new Error('error-ai-provider-not-configured');\n\t\t}\n\n\t\tconst systemPrompt = asString(systemPromptSetting);\n\n\t\tconst sanitizedMessages: SearchAnswerMessage[] = messages.map(({ text, username, roomName, ts, score }) => ({\n\t\t\ttext,\n\t\t\tusername,\n\t\t\troomName,\n\t\t\tts,\n\t\t\tscore,\n\t\t}));\n\n\t\treturn generateOpenAICompatibleSearchAnswer({\n\t\t\tquery,","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/2a7de457074cbb4d4373fbd9a4e5bea292c9c764/apps/meteor/server/services/ai-search/service.ts#L372-L408","documentation":"Thrown by the AI search service's answer() method when answer generation cannot run: the workspace lacks the intelligent-search license module, or AI_Intelligent_Search_Enabled / AI_Intelligent_Search_Answer_Enabled is not exactly true, or no search pipeline is configured. It is a plain Error whose message is the machine-readable code 'error-ai-not-enabled'.","triggerScenarios":"Calling aiSearch.answer(...) on Community/Enterprise without the AI license; license present but the two admin toggles left off; pipeline configuration (getPipelineConfig()) missing so there is nothing to source candidate messages from.","commonSituations":"Enabling an AI app on a workspace whose license does not include intelligent search; toggling the feature off mid-session while clients keep calling answer; fresh installs where the AI settings were never configured.","solutions":["Install/activate an Enterprise license that includes the AI intelligent-search module","Enable both settings: AI_Intelligent_Search_Enabled and AI_Intelligent_Search_Answer_Enabled","Configure the search pipeline (getPipelineConfig must return a config) and retry"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const enabled = await License.hasModule(AI_LICENSE_MODULE)\n  && settings.get('AI_Intelligent_Search_Enabled') === true\n  && settings.get('AI_Intelligent_Search_Answer_Enabled') === true\n  && Boolean(getPipelineConfig());\nif (!enabled) { /* hide answer UI */ }","typeGuard":"function aiAnswerAvailable(cfg: { licensed: boolean; searchEnabled: boolean; answerEnabled: boolean; pipeline: unknown }): boolean {\n  return cfg.licensed && cfg.searchEnabled && cfg.answerEnabled && Boolean(cfg.pipeline);\n}","tryCatchPattern":"try { await aiSearch.answer({ query, messages }); } catch (e) { if (e.message === 'error-ai-not-enabled') { /* degrade to plain search results */ } else throw e; }","preventionTips":["Gate the answer feature on license + both settings in the UI","Re-check feature flags when the license or settings change"],"tags":["ai","license","settings","enterprise","rocket-chat"],"backgroundTag":"feature-not-licensed","analyzedSha":"2a7de457074cbb4d4373fbd9a4e5bea292c9c764","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}