{"record":{"id":"0b3c50caf4993f8e","repo":"paperclipai/paperclip","slug":"failed-to-load-session-res-status","errorCode":null,"errorMessage":"Failed to load session (${res.status})","messagePattern":"Failed to load session \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ui/src/api/auth.ts","lineNumber":164,"sourceCode":"    const recovery = tenantSessionRecovery.recoverIfNeeded(res.status, payload);\n    if (recovery) return recovery;\n    throw extractAuthError(payload as AuthErrorBody, res.status);\n  }\n  return parse(payload);\n}\n\nexport const authApi = {\n  getSession: async (): Promise<AuthSession | null> => {\n    const res = await fetch(\"/api/auth/get-session\", {\n      credentials: \"include\",\n      headers: { Accept: \"application/json\" },\n    });\n    const payload = await res.json().catch(() => null);\n    if (!res.ok) {\n      const recovery = tenantSessionRecovery.recoverIfNeeded(res.status, payload);\n      if (recovery) return recovery;\n      if (res.status === 401) return null;\n      throw new Error(`Failed to load session (${res.status})`);\n    }\n    const direct = toSession(payload);\n    if (direct) return direct;\n    const nested = payload && typeof payload === \"object\" ? toSession((payload as Record<string, unknown>).data) : null;\n    return nested;\n  },\n\n  signInEmail: async (input: { email: string; password: string }) => {\n    await authPost(\"/sign-in/email\", input);\n  },\n\n  signUpEmail: async (input: { name: string; email: string; password: string }) => {\n    await authPost(\"/sign-up/email\", input);\n  },\n\n  getProfile: async (): Promise<CurrentUserProfile> => {\n    const res = await fetch(\"/api/auth/profile\", {\n      credentials: \"include\",","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/ui/src/api/auth.ts#L146-L182","documentation":"UI session bootstrap failure: /api/auth/get-session responded with a non-401 error status (401 itself maps to null = signed out). The Error with the status code indicates a server/network problem rather than an unauthenticated state; the app should treat the session as unknown and optionally retry.","triggerScenarios":"Thrown at ui/src/api/auth.ts:157 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Sign in again to refresh the session, then reload.","Check that the auth/session endpoint is reachable and the credentials are valid."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-10T03:14:50.855Z","contentChangedAt":"2026-09-10T03:14:50.855Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}