langflow-ai/langflow · error · HTTPException

Unknown provider: {provider}

Error message

Unknown provider: {provider}

What it means

Raised by the agentic assistant endpoints when the resolved provider passed the 'is enabled' check but has no entry in the model-provider-to-API-key-variable mapping (get_model_provider_variable_mapping). It means the provider slug is recognized as configured for the user, yet the backend has no variable name mapped to it, so it cannot look up credentials. It surfaces as HTTP 400 with detail "Unknown provider: {provider}".

Source

Thrown at src/backend/base/langflow/agentic/api/router.py:92

    provider = request.provider
    if not provider:
        for preferred in PREFERRED_PROVIDERS:
            if preferred in enabled_providers:
                provider = preferred
                break
        if not provider:
            provider = enabled_providers[0]

    if provider not in enabled_providers:
        raise HTTPException(
            status_code=400,
            detail=f"Provider '{provider}' is not configured. Available providers: {enabled_providers}",
        )

    api_key_name = provider_variable_map.get(provider)
    if not api_key_name:
        raise HTTPException(status_code=400, detail=f"Unknown provider: {provider}")

    model_name = request.model_name or get_default_model(provider, user_id=user_id) or ""

    # Get all configured variables for the provider
    provider_vars = get_all_variables_for_provider(user_id, provider)

    # Validate all required variables are present
    required_keys = get_provider_required_variable_keys(provider)
    missing_keys = [key for key in required_keys if not provider_vars.get(key)]

    if missing_keys:
        raise HTTPException(
            status_code=400,
            detail=(
                f"Missing required configuration for {provider}: {', '.join(missing_keys)}. "
                "Please configure these in Settings > Model Providers."
            ),
        )

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Omit request.provider and let the server auto-pick from PREFERRED_PROVIDERS / enabled_providers[0].
  2. Use one of the providers listed in the error/detail of a deliberate bad call, or fetch the enabled provider list for the user and pick from it.
  3. Verify the provider slug spelling exactly matches the mapping key (case-sensitive) used by get_model_provider_variable_mapping.
  4. If the provider should be supported, register its API-key variable name in the provider variable mapping (Settings > Model Providers / provider_service configuration) so provider_variable_map.get(provider) returns a key.

Example fix

// before
await fetch('/api/v1/agentic/assist', {method:'POST', body: JSON.stringify({provider: 'open_ai', input_value: 'hi'})});
// after
await fetch('/api/v1/agentic/assist', {method:'POST', body: JSON.stringify({provider: 'openai', input_value: 'hi'})}); // slug must exist in the provider variable map
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = new Set(['openai', 'anthropic', ...]); // mirror get_model_provider_variable_mapping keys
if (provider && !SUPPORTED.has(provider)) {
  provider = undefined; // let server auto-pick from enabled providers
}

Type guard

const isValidProvider = (p: string): boolean =>
  /^(openai|anthropic|google|mistral|cohere|groq)$/i.test(p);

Try / catch

try { await assist(body) } catch (e) { if (e.status === 400 && e.detail.startsWith('Unknown provider')) { retry without provider field } }

Prevention

When it happens

Trigger: POST /api/v1/agentic/assist (or /execute/{flow_name}, /assist/stream) with request.provider set to a slug that is in the user's enabled providers list but missing from the provider->variable map; typically a provider enabled via partial configuration (e.g. a non-default or newly added provider whose key mapping is not registered in get_model_provider_variable_mapping).

Common situations: Typo in a provider slug that happens to match an enabled row; a provider enabled in Settings > Model Providers without its required variable ever being defined; upgrading Langflow where a new provider was added to the enabled list but not to the variable map; custom/self-hosted deployments with modified provider mappings.

Related errors


AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14). Data as JSON: /api/errors/a7a4ec6e1e7a6a94. Report an issue: GitHub.