{"record":{"id":"37e301315e815e6c","repo":"srbhr/Resume-Matcher","slug":"failed-to-load-resumes-list-status-res-status","errorCode":null,"errorMessage":"Failed to load resumes list (status ${res.status}).","messagePattern":"Failed to load resumes list \\(status (.+?)\\)\\.","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/frontend/lib/api/resume.ts","lineNumber":207,"sourceCode":"  return postImprove('/resumes/improve/confirm', payload as unknown as Record<string, unknown>);\n}\n\n/** Fetches a raw resume record for previewing the original upload */\nexport async function fetchResume(resumeId: string): Promise<ResumeResponse['data']> {\n  const res = await apiFetch(`/resumes?resume_id=${encodeURIComponent(resumeId)}`);\n  if (!res.ok) {\n    throw new Error(`Failed to load resume (status ${res.status}).`);\n  }\n  const payload = (await res.json()) as ResumeResponse;\n  // Support both raw_resume content (initial) and processed_resume (if available)\n  // The viewer/builder logic should prioritize processed data if present\n  return payload.data;\n}\n\nexport async function fetchResumeList(includeMaster = false): Promise<ResumeListItem[]> {\n  const res = await apiFetch(`/resumes/list?include_master=${includeMaster ? 'true' : 'false'}`);\n  if (!res.ok) {\n    throw new Error(`Failed to load resumes list (status ${res.status}).`);\n  }\n  const payload = (await res.json()) as { data: ResumeListItem[] };\n  return payload.data;\n}\n\nexport async function updateResume(\n  resumeId: string,\n  resumeData: ProcessedResume\n): Promise<ResumeResponse['data']> {\n  const res = await apiPatch(`/resumes/${encodeURIComponent(resumeId)}`, resumeData);\n  if (!res.ok) {\n    const text = await res.text().catch(() => '');\n    throw new Error(`Failed to update resume (status ${res.status}): ${text}`);\n  }\n  const payload = (await res.json()) as ResumeResponse;\n  return payload.data;\n}\n","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/srbhr/Resume-Matcher/blob/116f9cc3b00e1ac91734a6c2679bf41ea64a0edc/apps/frontend/lib/api/resume.ts#L189-L225","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the status code in the message: 401/403 -> refresh authentication; 500 -> inspect backend logs for the resume query failure.","Confirm the backend version supports the include_master query parameter (404/400 suggests an API mismatch).","Verify the frontend API base URL / dev proxy points at the correct backend instance.","Catch the error in callers (data, ManualAddApplicationDialog) and render an empty/error list state with a retry button."],"exampleFix":"// before\nconst resumes = await fetchResumeList(true);\n\n// after\nlet resumes: ResumeListItem[] = [];\ntry {\n  resumes = await fetchResumeList(true);\n} catch (e) {\n  console.error('Failed to load resumes list:', (e as Error).message);\n}\nsetResumes(resumes);","handlingStrategy":"try-catch","validationCode":"if (typeof includeMaster !== 'boolean') {\n  throw new TypeError('includeMaster must be a boolean');\n}","typeGuard":"function isResumeList(x: unknown): x is ResumeListItem[] {\n  return Array.isArray(x) && x.every((i) => typeof i === 'object' && i !== null && 'id' in i);\n}","tryCatchPattern":"try {\n  const resumes = await fetchResumeList(includeMaster);\n} catch (e) {\n  const status = /status (\\d+)/.exec((e as Error).message)?.[1];\n  setListError(status === '401' ? 'Please sign in again.' : 'Could not load resumes.');\n}","preventionTips":["Always wrap list loads in try/catch and expose an error + retry state in the UI.","Verify backend/frontend API contract when adding new query params like include_master.","Re-authenticate proactively when the message reports 401/403.","Add a smoke test hitting GET /resumes/list in CI to catch route/schema drift."],"tags":["http-status","api-client","frontend","resume-list"],"backgroundTag":"http-error-response","analyzedSha":"116f9cc3b00e1ac91734a6c2679bf41ea64a0edc","analyzedAt":"2026-08-28T22:51:40.999Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}