{"record":{"id":"1a9390d62884c595","repo":"paperclipai/paperclip","slug":"failed-to-load-profile-res-status","errorCode":null,"errorMessage":"Failed to load profile (${res.status})","messagePattern":"Failed to load profile \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ui/src/api/auth.ts","lineNumber":180,"sourceCode":"    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\",\n      headers: { Accept: \"application/json\" },\n    });\n    const payload = await res.json().catch(() => null);\n    if (!res.ok) {\n      throw new Error((payload as { error?: string } | null)?.error ?? `Failed to load profile (${res.status})`);\n    }\n    return currentUserProfileSchema.parse(payload);\n  },\n\n  updateProfile: async (input: UpdateCurrentUserProfile): Promise<CurrentUserProfile> =>\n    authPatch(\"/profile\", input, (payload) => currentUserProfileSchema.parse(payload)),\n\n  signOut: async (): Promise<SignOutResult | null> => {\n    const payload = await authPost(\"/sign-out\", {});\n    if (!payload || typeof payload !== \"object\") return null;\n\n    const result = payload as Record<string, unknown>;\n    return {\n      ...(typeof result.success === \"boolean\" ? { success: result.success } : {}),\n      ...(typeof result.redirectTo === \"string\" ? { redirectTo: result.redirectTo } : {}),\n    };\n  },\n};","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/ui/src/api/auth.ts#L162-L198","documentation":"UI profile fetch failure: /api/auth/profile returned a non-OK status and the response body carried no error text, so a generic message with the HTTP status is thrown. Unlike get-session there is no null fallback — the caller must handle the error (e.g. show a retry) since the session exists but profile loading failed.","triggerScenarios":"Thrown at ui/src/api/auth.ts:180 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Sign in again and retry loading the profile.","Verify the profile endpoint is reachable and the session is valid."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}