srbhr/Resume-Matcher · error · Error

Failed to load resumes list (status ${res.status}).

Error message

Failed to load resumes list (status ${res.status}).

What it means

fetchResumeList loads the list of resume records via GET /resumes/list?include_master=... and throws this Error when the response status is not OK. It indicates the resume list endpoint failed, so the UI has no data to render. Unlike update/delete errors, it does not include a response body, only the status code.

Source

Thrown at apps/frontend/lib/api/resume.ts:207

  return postImprove('/resumes/improve/confirm', payload as unknown as Record<string, unknown>);
}

/** Fetches a raw resume record for previewing the original upload */
export async function fetchResume(resumeId: string): Promise<ResumeResponse['data']> {
  const res = await apiFetch(`/resumes?resume_id=${encodeURIComponent(resumeId)}`);
  if (!res.ok) {
    throw new Error(`Failed to load resume (status ${res.status}).`);
  }
  const payload = (await res.json()) as ResumeResponse;
  // Support both raw_resume content (initial) and processed_resume (if available)
  // The viewer/builder logic should prioritize processed data if present
  return payload.data;
}

export async function fetchResumeList(includeMaster = false): Promise<ResumeListItem[]> {
  const res = await apiFetch(`/resumes/list?include_master=${includeMaster ? 'true' : 'false'}`);
  if (!res.ok) {
    throw new Error(`Failed to load resumes list (status ${res.status}).`);
  }
  const payload = (await res.json()) as { data: ResumeListItem[] };
  return payload.data;
}

export async function updateResume(
  resumeId: string,
  resumeData: ProcessedResume
): Promise<ResumeResponse['data']> {
  const res = await apiPatch(`/resumes/${encodeURIComponent(resumeId)}`, resumeData);
  if (!res.ok) {
    const text = await res.text().catch(() => '');
    throw new Error(`Failed to update resume (status ${res.status}): ${text}`);
  }
  const payload = (await res.json()) as ResumeResponse;
  return payload.data;
}

View on GitHub (pinned to 116f9cc3b0)

Solutions

  1. Check the status code in the message: 401/403 -> refresh authentication; 500 -> inspect backend logs for the resume query failure.
  2. Confirm the backend version supports the include_master query parameter (404/400 suggests an API mismatch).
  3. Verify the frontend API base URL / dev proxy points at the correct backend instance.
  4. Catch the error in callers (data, ManualAddApplicationDialog) and render an empty/error list state with a retry button.

Example fix

// before
const resumes = await fetchResumeList(true);

// after
let resumes: ResumeListItem[] = [];
try {
  resumes = await fetchResumeList(true);
} catch (e) {
  console.error('Failed to load resumes list:', (e as Error).message);
}
setResumes(resumes);
Defensive patterns

Strategy: try-catch

Validate before calling

if (typeof includeMaster !== 'boolean') {
  throw new TypeError('includeMaster must be a boolean');
}

Type guard

function isResumeList(x: unknown): x is ResumeListItem[] {
  return Array.isArray(x) && x.every((i) => typeof i === 'object' && i !== null && 'id' in i);
}

Try / catch

try {
  const resumes = await fetchResumeList(includeMaster);
} catch (e) {
  const status = /status (\d+)/.exec((e as Error).message)?.[1];
  setListError(status === '401' ? 'Please sign in again.' : 'Could not load resumes.');
}

Prevention

When it happens

Trigger: apiFetch('/resumes/list?include_master=true|false') returns a non-2xx status: backend 500 while querying the resume store, 401/403 from an expired session, or the /resumes/list route missing (404) when frontend and backend versions are out of sync.

Common situations: Opening the applications dialog (ManualAddApplicationDialog) against a backend that was restarted or migrated; include_master=true hitting an older backend that does not support the flag; proxy misconfiguration in development.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of srbhr/Resume-Matcher@116f9cc3b0 (2026-08-28). Data as JSON: /api/errors/37e301315e815e6c. Report an issue: GitHub.