{"record":{"id":"049d731729014260","repo":"moeru-ai/airi","slug":"unexpected-response","errorCode":null,"errorMessage":"Unexpected response","messagePattern":"Unexpected response","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/ui-server-auth/src/modules/sign-in.ts","lineNumber":117,"sourceCode":"    return null\n  }\n}\n\nexport async function requestSocialSignInRedirect(params: SocialSignInRedirectParams): Promise<string> {\n  const client = getAuthClient({ apiServerUrl: params.apiServerUrl, fetchImpl: params.fetchImpl })\n\n  // Steam is OpenID 2.0, not OAuth2 — the server steam plugin exposes\n  // `/sign-in/steam`, surfaced here as the typed `signIn.steam` action.\n  // Other providers use the standard `/sign-in/social`.\n  const result = params.provider === 'steam'\n    ? await client.signIn.steam({ callbackURL: params.callbackURL, disableRedirect: true })\n    : await client.signIn.social({ provider: params.provider, callbackURL: params.callbackURL, disableRedirect: true })\n\n  const url = result.data?.url\n  if (typeof url === 'string')\n    return url\n\n  throw new Error(extractAuthError(result.data ?? result.error) ?? 'Unexpected response')\n}\n","sourceCodeStart":99,"sourceCodeEnd":119,"githubUrl":"https://github.com/moeru-ai/airi/blob/27111382b4a79a7e983289d6e983a06af185ed0f/apps/ui-server-auth/src/modules/sign-in.ts#L99-L119","documentation":"Thrown by requestSocialSignInRedirect when the better-auth social/steam sign-in call returns no redirect URL. The function expects result.data.url to be a string (the OAuth/OpenID redirect URL). It tries extractAuthError on result.data ?? result.error first; the generic 'Unexpected response' fires only when neither a URL nor an error message is present.","triggerScenarios":"The auth server's social provider plugin is not configured (missing OAuth client ID/secret) and returns a 200 with no url; provider name is not registered server-side; Steam OpenID plugin misconfigured; better-auth version changed the response envelope so .url moved.","commonSituations":"Forgetting to set the Google/GitHub/Discord OAuth env vars on the auth server; passing a provider string the server does not recognize; Steam plugin disabled; client/server better-auth version mismatch altering the redirect payload shape.","solutions":["Verify the social provider is configured server-side (client ID, secret, enabled scopes).","Confirm params.provider matches a server-registered provider key; for Steam ensure the steam plugin is loaded.","Check result.error for a server message — if present it is included before this fallback.","Align client and server better-auth versions so the .url field contract holds."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const url = await requestSocialSignInRedirect(params)\n  window.location.assign(url)\n} catch (e) {\n  // e.message may carry extractAuthError output or 'Unexpected response'\n  // surface to the user and verify the provider is configured server-side\n}","preventionTips":["Confirm each social provider has OAuth credentials set in the auth server env.","Keep client and server better-auth versions aligned so the .url contract holds.","Validate params.provider against the server-registered provider list before calling."],"tags":["auth","signin","oauth","better-auth","ui-server-auth"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}