RocketChat/Rocket.Chat · error · Error

error-ai-provider-not-configured

Error message

error-ai-provider-not-configured

What it means

Thrown by the AI search service's answer() method when getAnswerProviderConfig() returns nothing — the LLM backend that generates answers is not configured. This check runs after the enablement checks, so the feature is licensed and on, but no provider (e.g. an OpenAI-compatible endpoint and model) is set up.

Source

Thrown at apps/meteor/server/services/ai-search/service.ts:394

		});

		return this.normalizeIntelligentResults(json, userId, limit);
	}

	async answer({ query, messages }: { query: string; messages: AISearchAnswerMessage[] }): Promise<AISearchAnswerResult> {
		const hasIntelligentSearchLicense = await License.hasModule(AI_LICENSE_MODULE);
		const intelligentSearchEnabled = settings.get<boolean>('AI_Intelligent_Search_Enabled');
		const answerGenerationEnabled = settings.get<boolean>('AI_Intelligent_Search_Answer_Enabled');
		const pipelineConfig = this.getPipelineConfig();
		const provider = this.getAnswerProviderConfig();
		const systemPromptSetting = settings.get<string>('AI_Intelligent_Search_Answer_System_Prompt');

		if (!hasIntelligentSearchLicense || intelligentSearchEnabled !== true || answerGenerationEnabled !== true || !pipelineConfig) {
			throw new Error('error-ai-not-enabled');
		}

		if (!provider) {
			throw new Error('error-ai-provider-not-configured');
		}

		const systemPrompt = asString(systemPromptSetting);

		const sanitizedMessages: SearchAnswerMessage[] = messages.map(({ text, username, roomName, ts, score }) => ({
			text,
			username,
			roomName,
			ts,
			score,
		}));

		return generateOpenAICompatibleSearchAnswer({
			query,
			messages: sanitizedMessages,
			provider,
			systemPrompt,
			fetch: fetchWithSsrfValidation,

View on GitHub (pinned to 2a7de45707)

Solutions

  1. Configure an answer provider (OpenAI-compatible base URL, API key, model) in the AI administration panel
  2. Verify the saved settings parse into a provider object via the same getAnswerProviderConfig logic
  3. Hide the answer affordance in the UI when no provider is configured
Defensive patterns

Strategy: try-catch

Validate before calling

const provider = getAnswerProviderConfig();
if (!provider) { /* hide/disable answer generation until a provider is configured */ }

Type guard

function hasAnswerProvider(p: { baseURL?: string; apiKey?: string; model?: string } | undefined | null): p is { baseURL: string; apiKey: string; model: string } {
  return Boolean(p && p.baseURL && p.apiKey && p.model);
}

Try / catch

try { await aiSearch.answer({ query, messages }); } catch (e) { if (e.message === 'error-ai-provider-not-configured') { /* surface admin setup hint */ } else throw e; }

Prevention

When it happens

Trigger: Calling aiSearch.answer(...) with no AI provider configured in administration; provider configuration saved partially so parsing yields undefined; provider entries removed after clients already show the answer UI.

Common situations: Admins enable intelligent search but never fill the external provider section; rotating/clearing provider credentials; air-gapped installs where the provider was never reachable and the config was dropped.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@2a7de45707 (2026-08-18). Data as JSON: /api/errors/d5c26f1ba2ef7aaf. Report an issue: GitHub.