{"record":{"id":"734d45fff6808329","repo":"open-webui/open-webui","slug":"failed-to-register-oauth-client-e","errorCode":null,"errorMessage":"Failed to register OAuth client: {e}","messagePattern":"Failed to register OAuth client: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"backend/open_webui/routers/configs.py","lineNumber":206,"sourceCode":"            oauth_client_info = await get_oauth_client_info_with_static_credentials(\n                request,\n                oauth_client_id,\n                oauth_server_url,\n                oauth_client_id=form_data.client_id,\n                oauth_client_secret=form_data.client_secret,\n                oauth_scope=form_data.oauth_scope,\n            )\n        else:\n            oauth_client_info = await get_oauth_client_info_with_dynamic_client_registration(\n                request, oauth_client_id, oauth_server_url, oauth_scope=form_data.oauth_scope\n            )\n        return {\n            'status': True,\n            'oauth_client_info': encrypt_data(oauth_client_info.model_dump(mode='json')),\n        }\n    except Exception as e:\n        log.debug(f'Failed to register OAuth client: {e}')\n        raise HTTPException(\n            status_code=400,\n            detail=f'Failed to register OAuth client: {e}',\n        )\n\n\n############################\n# ToolServers Config\n############################\n\n\nclass ToolServerConnection(BaseModel):\n    url: str\n    path: str\n    type: str | None = 'openapi'  # openapi, mcp\n    auth_type: str | None\n    headers: dict | str | None = None\n    key: str | None\n    config: dict | None","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/open-webui/open-webui/blob/01f4282f1ffe0d6212f58d3afbeae21fffd0c4be/backend/open_webui/routers/configs.py#L188-L224","documentation":"Admin config endpoint that registers an OAuth client (static or RFC 7591 dynamic client registration). Any exception during discovery/registration is caught, logged at debug, and re-raised as 400 with 'Failed to register OAuth client: {e}'. The detail carries the underlying exception text, so the message is the diagnosis.","triggerScenarios":"POST to the SSO/OAuth config endpoint with an oauth_server_url that is unreachable, has a malformed issuer/discovery document, rejects the registration request, or where dynamic registration is not supported by the provider.","commonSituations":"Wrong issuer URL (missing/wrong path, http vs https), self-signed certificate without trust config, provider requiring an initial access token for DCR, network egress blocked from the open-webui host, or unsupported grant/scope parameters.","solutions":["Read the detail text and server debug logs — the underlying exception names the real cause (DNS, TLS, 4xx from provider).","curl the provider's {issuer}/.well-known/openid-configuration and the registration_endpoint from the open-webui host to verify reachability and DCR support.","If the provider does not support dynamic registration, pre-register the client and supply the static client_id/secret instead of this endpoint.","Fix scheme/URL typos (trailing slashes, http on an https-only provider) and ensure the server clock/TLS trust store is correct."],"exampleFix":"// before\noauth_server_url = 'http://sso.internal:8080';\n\n// after\n// verify discovery first, then submit\nconst disc = await fetch('https://sso.internal/.well-known/openid-configuration');\nif (!disc.ok) throw new Error('issuer unreachable');\nconst { registration_endpoint } = await disc.json();\nif (!registration_endpoint) { /* use static client registration */ }","handlingStrategy":"validation","validationCode":"// prove discovery + DCR support from the open-webui host before calling the endpoint\nconst disc = await fetch(`${issuer.replace(/\\/$/, '')}/.well-known/openid-configuration`);\nif (!disc.ok) throw new Error('issuer discovery failed');\nconst { registration_endpoint } = await disc.json();\nif (!registration_endpoint) throw new Error('provider has no dynamic registration — use static client');","typeGuard":null,"tryCatchPattern":"try { await api.post('/configs/oauth/register', payload); } catch (e) { const detail = e.response?.data?.detail ?? ''; // detail embeds the provider error\n log(detail); throw new Error(detail || 'oauth registration failed'); }","preventionTips":["Always curl the discovery document from the open-webui host, not your laptop","Prefer static client credentials for providers without RFC 7591 support","Surface the embedded {e} text to admins — it names the real cause"],"tags":["open-webui","oauth","dynamic-client-registration","http-400","sso"],"backgroundTag":null,"analyzedSha":"01f4282f1ffe0d6212f58d3afbeae21fffd0c4be","analyzedAt":"2026-08-14T18:25:22.715Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}