{"record":{"id":"033a9ca7070cd221","repo":"decolua/9router","slug":"client-registration-failed-error","errorCode":null,"errorMessage":"`Client registration failed: ${error}`","messagePattern":"`Client registration failed: (.+?)`","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/oauth/providers/kiro.js","lineNumber":36,"sourceCode":"    // Step 1: Register client with AWS SSO OIDC\n    const registerRes = await fetch(registerClientUrl, {\n      method: \"POST\",\n      headers: {\n        \"Content-Type\": \"application/json\",\n        Accept: \"application/json\",\n      },\n      body: JSON.stringify({\n        clientName: config.clientName,\n        clientType: config.clientType,\n        scopes: config.scopes,\n        grantTypes: config.grantTypes,\n        issuerUrl: config.issuerUrl,\n      }),\n    });\n\n    if (!registerRes.ok) {\n      const error = await registerRes.text();\n      throw new Error(`Client registration failed: ${error}`);\n    }\n\n    const clientInfo = await registerRes.json();\n\n    // Step 2: Request device authorization\n    const deviceRes = await fetch(deviceAuthUrl, {\n      method: \"POST\",\n      headers: {\n        \"Content-Type\": \"application/json\",\n        Accept: \"application/json\",\n      },\n      body: JSON.stringify({\n        clientId: clientInfo.clientId,\n        clientSecret: clientInfo.clientSecret,\n        startUrl,\n      }),\n    });\n","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/decolua/9router/blob/90b52e06ffd666b7929554211474d01588f6b1f8/src/lib/oauth/providers/kiro.js#L18-L54","documentation":"Thrown by the Kiro OAuth provider during step 1 of its device login: the dynamic client registration request (POST with issuerUrl) returned non-2xx, so no clientInfo exists for the subsequent device-authorization call. The raw upstream error body is included in the message.","triggerScenarios":"The Kiro client-registration endpoint rejects the request: bad/expired config.issuerUrl, registration service rejecting the client metadata, 5xx on the registration service, or network interception of the request.","commonSituations":"Stale config.issuerUrl after an AWS/Kiro endpoint change; registration endpoint temporarily down; proxy stripping or mangling the registration POST body; regional endpoint unreachable.","solutions":["Read the embedded response body in the message for the upstream rejection reason.","Verify config.issuerUrl points at the current, correct Kiro issuer endpoint.","Test the registration endpoint reachability with curl using the same payload.","Retry later if the body/status indicates a server-side outage (5xx)."],"exampleFix":"// before\nissuerUrl: 'https://old-kiro-endpoint.example.com'\n// after\nissuerUrl: 'https://current-kiro-issuer.example.com'  // update to the current issuer","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await kiroProvider.login(config);\n} catch (e) {\n  if (e.message.startsWith('Client registration failed:')) {\n    // inspect embedded body; verify issuerUrl, then retry with backoff for 5xx\n  } else throw e;\n}","preventionTips":["Keep config.issuerUrl in sync with the current Kiro issuer endpoint; update after upstream migrations.","Always run registration and device authorization as one fresh flow; don't cache clientInfo across sessions.","Add retry-with-backoff for transient 5xx registration failures."],"tags":["oauth","device-code-flow","client-registration","http-4xx"],"backgroundTag":"client-registration-failed","analyzedSha":"90b52e06ffd666b7929554211474d01588f6b1f8","analyzedAt":"2026-08-30T21:05:45.952Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}