{"record":{"id":"52acfc17f69557f1","repo":"BloopAI/vibe-kanban","slug":"auth-methods-lookup-failed-res-status","errorCode":null,"errorMessage":"Auth methods lookup failed (${res.status})","messagePattern":"Auth methods lookup failed \\((.+?)\\)","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/remote-web/src/shared/lib/api.ts","lineNumber":75,"sourceCode":"    headers: { \"Content-Type\": \"application/json\" },\n    body: JSON.stringify({\n      provider,\n      return_to: returnTo,\n      app_challenge: appChallenge,\n    }),\n  });\n  if (!res.ok) {\n    throw new Error(`OAuth init failed (${res.status})`);\n  }\n  return res.json();\n}\n\nexport async function getAuthMethods(): Promise<AuthMethodsResponse> {\n  const res = await fetch(`${API_BASE}/v1/auth/methods`, {\n    cache: \"no-store\",\n  });\n  if (!res.ok) {\n    throw new Error(`Auth methods lookup failed (${res.status})`);\n  }\n  return res.json();\n}\n\nexport async function redeemOAuth(\n  handoffId: string,\n  appCode: string,\n  appVerifier: string,\n): Promise<HandoffRedeemResponse> {\n  const res = await fetch(`${API_BASE}/v1/oauth/web/redeem`, {\n    method: \"POST\",\n    headers: { \"Content-Type\": \"application/json\" },\n    body: JSON.stringify({\n      handoff_id: handoffId,\n      app_code: appCode,\n      app_verifier: appVerifier,\n    }),\n  });","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/packages/remote-web/src/shared/lib/api.ts#L57-L93","documentation":"getAuthMethods fetches the available sign-in methods from GET ${API_BASE}/v1/auth/methods (with cache:'no-store') so the login page can show local-password and/or OAuth options. If the response is not OK, it throws 'Auth methods lookup failed (<status>)'. This error means the client could not determine which authentication methods the server supports.","triggerScenarios":"Calling getAuthMethods() and the GET /v1/auth/methods request returns non-2xx: wrong API_BASE so route 404s, server error while reading auth configuration (500), server restarting or behind a failing proxy (502/503), or rate limiting (429). Network-level failures throw fetch TypeErrors instead — this error fires only when an HTTP response was received with a bad status.","commonSituations":"Login page loads while the remote API is down or deploying; VITE_API_BASE_URL unset or misconfigured in a self-hosted deployment; older server version without /v1/auth/methods route (404); corporate proxy returning 5xx for the API host.","solutions":["Read the HTTP status from the error message and correlate with server logs for /v1/auth/methods.","Verify VITE_API_BASE_URL points at the correct remote API server.","Confirm the deployed server version includes the /v1/auth/methods endpoint (upgrade if 404).","Check server auth configuration load errors (500 usually means the backend failed to read its auth settings).","Implement a UI fallback so the login page still renders (e.g. default to showing OAuth options) when lookup fails, and retry.","Retry after transient 5xx/429 conditions clear."],"exampleFix":"// before\nconst methods = await getAuthMethods();\n\n// after: degrade gracefully\nlet methods: AuthMethodsResponse | null = null;\ntry {\n  methods = await getAuthMethods();\n} catch {\n  methods = { local_auth_enabled: true, oauth_providers: ['github', 'google'] };\n}","handlingStrategy":"fallback","validationCode":"// check API reachability before fetching auth methods\nconst ping = await fetch(`${API_BASE}/v1/auth/methods`, { method: 'HEAD' }).catch(() => null);\nif (!ping || !ping.ok) {\n  console.warn('auth methods endpoint unreachable; using defaults');\n}","typeGuard":"function isAuthMethodsResponse(x: unknown): x is AuthMethodsResponse {\n  return typeof x === 'object' && x !== null\n    && typeof (x as any).local_auth_enabled === 'boolean'\n    && Array.isArray((x as any).oauth_providers);\n}","tryCatchPattern":"let methods: AuthMethodsResponse;\ntry {\n  methods = await getAuthMethods();\n} catch (e) {\n  const status = (e as Error).message.match(/\\((\\d+)\\)/)?.[1];\n  console.warn(`auth methods lookup failed (HTTP ${status ?? 'network'}), falling back`);\n  methods = { local_auth_enabled: true, oauth_providers: ['github', 'google'] };\n}","preventionTips":["Set VITE_API_BASE_URL correctly for the deployment environment.","Add a login-page fallback so auth method lookup failure does not block sign-in.","Use cache:'no-store' (as the library does) and refetch on window focus to recover after transient failures.","Confirm the deployed server version exposes /v1/auth/methods.","Alert on 5xx rates for /v1/auth/methods."],"tags":["http","authentication","network"],"backgroundTag":"auth-methods-lookup-failed","analyzedSha":"4deb7eca8f381f7cbc1f9d15515a9ab8f8009053","analyzedAt":"2026-08-29T09:24:13.446Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}