{"record":{"id":"5bcc580ff3e66d73","repo":"langflow-ai/langflow","slug":"missing-required-configuration-for-provider","errorCode":null,"errorMessage":"Missing required configuration for {provider}: {', '.join(missing_keys)}. Please configure these in Settings > Model Providers.","messagePattern":"Missing required configuration for (.+?): (.+?)\\. Please configure these in Settings > Model Providers\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"src/backend/base/langflow/agentic/api/router.py","lineNumber":104,"sourceCode":"            status_code=400,\n            detail=f\"Provider '{provider}' is not configured. Available providers: {enabled_providers}\",\n        )\n\n    api_key_name = provider_variable_map.get(provider)\n    if not api_key_name:\n        raise HTTPException(status_code=400, detail=f\"Unknown provider: {provider}\")\n\n    model_name = request.model_name or get_default_model(provider, user_id=user_id) or \"\"\n\n    # Get all configured variables for the provider\n    provider_vars = get_all_variables_for_provider(user_id, provider)\n\n    # Validate all required variables are present\n    required_keys = get_provider_required_variable_keys(provider)\n    missing_keys = [key for key in required_keys if not provider_vars.get(key)]\n\n    if missing_keys:\n        raise HTTPException(\n            status_code=400,\n            detail=(\n                f\"Missing required configuration for {provider}: {', '.join(missing_keys)}. \"\n                \"Please configure these in Settings > Model Providers.\"\n            ),\n        )\n\n    global_vars: dict[str, str] = {\n        \"USER_ID\": str(user_id),\n        \"FLOW_ID\": request.flow_id,\n        \"MODEL_NAME\": model_name,\n        \"PROVIDER\": provider,\n    }\n\n    # Seeded here (not per-endpoint) so /assist and /execute/{flow_name}\n    # honor the budget the same way /assist/stream does.\n    if request.iterations_limit is not None:\n        global_vars[\"ITERATIONS_LIMIT\"] = str(request.iterations_limit)","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/agentic/api/router.py#L86-L122","documentation":"Raised when the chosen model provider is enabled and mapped, but one or more of its required configuration variables (API keys, base URLs, etc. from get_provider_required_variable_keys) have no value stored for the current user. The assistant cannot run a flow that embeds a model without those credentials. HTTP 400; the detail lists the exact missing variable names.","triggerScenarios":"POST /api/v1/agentic/assist* with a provider whose required variable keys (e.g. OPENAI_API_KEY) are empty/unset for the user in the variables store; happens before any flow executes, inside _resolve_assistant_context.","commonSituations":"Fresh install where a provider was selected but keys never saved; user switched workspace/account so their stored variables no longer apply; key deleted from Settings after being enabled; providers requiring multiple variables (key + base URL) with only one filled in.","solutions":["Open Settings > Model Providers in the Langflow UI and fill in every variable named in the error detail, then retry.","If multiple providers are configured, retry with request.provider pointing at one whose required keys are all set.","Programmatically, upsert the missing variables via the variables API (POST /api/v1/variables) for the current user before calling the assistant endpoint.","Check with get_provider_required_variable_keys(provider) in your environment/tooling to know exactly which keys are mandatory."],"exampleFix":"# before\nresp = await client.post('/api/v1/agentic/assist', json={'provider': 'anthropic', 'input_value': 'hi'})\n# 400 Missing required configuration for anthropic: ANTHROPIC_API_KEY\n# after\nawait client.post('/api/v1/variables', json={'name': 'ANTHROPIC_API_KEY', 'value': sk})\nresp = await client.post('/api/v1/agentic/assist', json={'provider': 'anthropic', 'input_value': 'hi'})","handlingStrategy":"validation","validationCode":"// Before calling /agentic/assist, verify required vars exist for the user\nconst vars = await fetch('/api/v1/variables').then(r => r.json());\nconst required = providerRequiredKeys[provider] ?? []; // e.g. ['OPENAI_API_KEY']\nconst missing = required.filter(k => !vars.some(v => v.name === k && v.value));\nif (missing.length) openProviderSettings(missing);","typeGuard":null,"tryCatchPattern":"catch HTTP 400 whose detail matches /Missing required configuration for (\\w+): (.+)./ -> parse missing keys and deep-link the user to Settings > Model Providers.","preventionTips":["Gate the assistant UI behind a provider-readiness check that reads required keys per provider.","After any workspace/account switch, re-verify provider variables before the first assist call.","Automate key setup via POST /api/v1/variables during onboarding."],"tags":["agentic","provider","api-key","http-400","configuration"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}