{"record":{"id":"0cf6e062075c89a5","repo":"nexu-io/open-design","slug":"dynamic-client-registration-failed-http-res-sta","errorCode":null,"errorMessage":"dynamic client registration failed: HTTP ${res.status} ${res.statusText} ${txt}","messagePattern":"dynamic client registration failed: HTTP (.+?) (.+?) (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/daemon/src/mcp-oauth.ts","lineNumber":269,"sourceCode":"  const body = {\n    redirect_uris: [redirectUri],\n    token_endpoint_auth_method: 'none',\n    grant_types: ['authorization_code', 'refresh_token'],\n    response_types: ['code'],\n    client_name: 'Open Design',\n    application_type: 'web',\n  };\n  const res = await fetchImpl(registrationEndpoint, {\n    method: 'POST',\n    headers: {\n      'content-type': 'application/json',\n      accept: 'application/json',\n    },\n    body: JSON.stringify(body),\n  });\n  if (!res.ok) {\n    const txt = await safeText(res);\n    throw new Error(\n      `dynamic client registration failed: HTTP ${res.status} ${res.statusText} ${txt}`,\n    );\n  }\n  const json = (await res.json()) as { client_id?: string; client_secret?: string };\n  if (!json.client_id) {\n    throw new Error('dynamic client registration response missing client_id');\n  }\n  const out: { clientId: string; clientSecret?: string } = { clientId: json.client_id };\n  if (json.client_secret) out.clientSecret = json.client_secret;\n  return out;\n}\n\n/**\n * Cached version of `registerClient`. Looks up `(authServerIssuer, redirectUri)`\n * in the cache file and re-uses the existing client; falls back to a fresh\n * DCR call when nothing is cached.\n */\nexport async function getOrRegisterClient(","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/mcp-oauth.ts#L251-L287","documentation":"registerClient POSTs a Dynamic Client Registration (DCR) request to the auth server's registration_endpoint. Any non-2xx response is surfaced as a failure along with status, statusText, and up to 500 chars of body. Causes range from the endpoint rejecting DCR (4xx) to network or server errors (5xx).","triggerScenarios":"Auth server rejected DCR with 400, 401, or 403; registration_endpoint is wrong or unreachable; server returned 5xx; rate limited with 429.","commonSituations":"An MCP provider does not actually support DCR despite advertising an endpoint; a corporate proxy returns 4xx; the redirectUri is not allowlisted.","solutions":["Inspect the embedded status and body text in the message to see the server's reason.","Confirm registration_endpoint is correct and reachable.","Verify redirectUri is permitted by the provider.","If DCR is unsupported, pre-register a client and seed the cache (see getOrRegisterClient)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await registerClient(registrationEndpoint, redirectUri);\n} catch (e) {\n  if (/dynamic client registration failed/i.test(e.message)) {\n    // message carries HTTP status + up to 500 chars of body\n    logOAuthDetail(e.message);\n    // for providers that reject DCR, fall back to a pre-registered client\n  }\n  throw e;\n}","preventionTips":["Confirm the provider actually supports DCR before relying on it.","Pre-seed a client in the cache for providers that do not.","Make sure redirectUri is on the provider's allowlist."],"tags":["oauth","dcr","network"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}