moeru-ai/airi · error · Error

Unexpected response

Error message

Unexpected response

What it means

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.

Source

Thrown at apps/ui-server-auth/src/modules/sign-in.ts:117

    return null
  }
}

export async function requestSocialSignInRedirect(params: SocialSignInRedirectParams): Promise<string> {
  const client = getAuthClient({ apiServerUrl: params.apiServerUrl, fetchImpl: params.fetchImpl })

  // Steam is OpenID 2.0, not OAuth2 — the server steam plugin exposes
  // `/sign-in/steam`, surfaced here as the typed `signIn.steam` action.
  // Other providers use the standard `/sign-in/social`.
  const result = params.provider === 'steam'
    ? await client.signIn.steam({ callbackURL: params.callbackURL, disableRedirect: true })
    : await client.signIn.social({ provider: params.provider, callbackURL: params.callbackURL, disableRedirect: true })

  const url = result.data?.url
  if (typeof url === 'string')
    return url

  throw new Error(extractAuthError(result.data ?? result.error) ?? 'Unexpected response')
}

View on GitHub (pinned to 27111382b4)

Solutions

  1. Verify the social provider is configured server-side (client ID, secret, enabled scopes).
  2. Confirm params.provider matches a server-registered provider key; for Steam ensure the steam plugin is loaded.
  3. Check result.error for a server message — if present it is included before this fallback.
  4. Align client and server better-auth versions so the .url field contract holds.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const url = await requestSocialSignInRedirect(params)
  window.location.assign(url)
} catch (e) {
  // e.message may carry extractAuthError output or 'Unexpected response'
  // surface to the user and verify the provider is configured server-side
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12). Data as JSON: /api/errors/049d731729014260. Report an issue: GitHub.