srbhr/Resume-Matcher · error · Error
Failed to load resume (status ${res.status}).
Error message
Failed to load resume (status ${res.status}). What it means
fetchResume retrieves a single raw resume record for previewing the original upload via GET /resumes?resume_id=... When the backend responds with a non-2xx status, the client discards any body and throws this Error with the HTTP status code embedded. It signals that the resume could not be loaded from the API, not a client-side data problem.
Source
Thrown at apps/frontend/lib/api/resume.ts:196
return postImprove('/resumes/improve/preview', {
resume_id: resumeId,
job_id: jobId,
prompt_id: promptId ?? null,
});
}
/** Confirms and saves a tailored resume */
export async function confirmImproveResume(
payload: ImproveResumeConfirmRequest
): Promise<ImprovedResult> {
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,View on GitHub (pinned to 116f9cc3b0)
Solutions
- Log/inspect the status in the thrown message and verify the resumeId exists via GET /resumes/list before calling fetchResume.
- Check authentication: ensure the session/token is valid and apiFetch attaches credentials; re-authenticate on 401.
- Confirm the frontend API base URL/proxy targets the running backend (404 often means wrong base path or backend not started).
- Add graceful UI handling: catch the error and show a 'resume not found / unavailable' state instead of crashing the preview.
Example fix
// before
const resume = await fetchResume(resumeId);
// after
let resume;
try {
resume = await fetchResume(resumeId);
} catch (e) {
console.error('Resume load failed:', (e as Error).message);
showUnavailableState();
} Defensive patterns
Strategy: try-catch
Validate before calling
const list = await fetchResumeList(false);
if (!list.some((r) => r.id === resumeId)) {
console.warn('Skipping fetchResume: unknown resumeId', resumeId);
} Type guard
function isResumeData(x: unknown): x is ResumeResponse['data'] {
return typeof x === 'object' && x !== null && 'id' in x;
} Try / catch
try {
const resume = await fetchResume(resumeId);
} catch (e) {
if ((e as Error).message.includes('status 404')) {
showNotFoundState();
} else {
showGenericError(e);
}
} Prevention
- Validate the resumeId against fetchResumeList before previewing.
- Handle 401 centrally (apiFetch interceptor) so expired sessions refresh tokens before requests.
- Render a friendly empty/error state instead of letting the promise rejection bubble to the console.
- Keep frontend API base URL/proxy config in one shared module to avoid 404s from drift.
When it happens
Trigger: apiFetch(`/resumes?resume_id=${encodeURIComponent(resumeId)}`) returns res.ok === false: the resumeId does not exist (404), the request is unauthenticated/forbidden (401/403), the backend /resumes GET route is down or returns 500, or the id was malformed so the server rejects it (400).
Common situations: Previewing an uploaded resume after the record was deleted (e.g. by another tab or a re-upload flow); stale IDs cached in UI state after a database reset; dev server proxy not pointing at the API so requests 404; expired auth session returning 401.
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
- Failed to load resumes list (status ${res.status}).
- Failed to delete resume (status ${res.status}): ${text}
- Failed to update resume (status ${res.status}): ${text}
- Failed to download resume (status ${res.status}): ${text}
- Failed to update cover letter (status ${res.status}): ${text
AI-assisted analysis of srbhr/Resume-Matcher@116f9cc3b0 (2026-08-28).
Data as JSON: /api/errors/2634cba7555e95c3.
Report an issue: GitHub.