paperclipai/paperclip · error

Failed to load session (${res.status})

Error message

Failed to load session (${res.status})

What it means

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.

Source

Thrown at ui/src/api/auth.ts:164

    const recovery = tenantSessionRecovery.recoverIfNeeded(res.status, payload);
    if (recovery) return recovery;
    throw extractAuthError(payload as AuthErrorBody, res.status);
  }
  return parse(payload);
}

export const authApi = {
  getSession: async (): Promise<AuthSession | null> => {
    const res = await fetch("/api/auth/get-session", {
      credentials: "include",
      headers: { Accept: "application/json" },
    });
    const payload = await res.json().catch(() => null);
    if (!res.ok) {
      const recovery = tenantSessionRecovery.recoverIfNeeded(res.status, payload);
      if (recovery) return recovery;
      if (res.status === 401) return null;
      throw new Error(`Failed to load session (${res.status})`);
    }
    const direct = toSession(payload);
    if (direct) return direct;
    const nested = payload && typeof payload === "object" ? toSession((payload as Record<string, unknown>).data) : null;
    return nested;
  },

  signInEmail: async (input: { email: string; password: string }) => {
    await authPost("/sign-in/email", input);
  },

  signUpEmail: async (input: { name: string; email: string; password: string }) => {
    await authPost("/sign-up/email", input);
  },

  getProfile: async (): Promise<CurrentUserProfile> => {
    const res = await fetch("/api/auth/profile", {
      credentials: "include",

View on GitHub (pinned to 01ad858492)

Solutions

  1. Sign in again to refresh the session, then reload.
  2. Check that the auth/session endpoint is reachable and the credentials are valid.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at ui/src/api/auth.ts:157 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-09-10). Data as JSON: /api/errors/0b3c50caf4993f8e. Report an issue: GitHub.