{"record":{"id":"166a114f29cd4c40","repo":"srbhr/Resume-Matcher","slug":"str-e","errorCode":null,"errorMessage":"str(e)","messagePattern":"str\\(e\\)","errorType":"http","errorClass":"HTTPException (wraps PDFRenderError)","httpStatus":503,"severity":"error","filePath":"apps/backend/app/routers/resumes.py","lineNumber":1663,"sourceCode":"        f\"&accentColor={accentColor}\"\n    )\n    if lang:\n        params = f\"{params}&lang={lang}\"\n    url = f\"{settings.frontend_base_url}/print/resumes/{resume_id}?{params}\"\n\n    # Use the exact margins provided; compact mode only affects spacing.\n    pdf_margins = {\n        \"top\": marginTop,\n        \"right\": marginRight,\n        \"bottom\": marginBottom,\n        \"left\": marginLeft,\n    }\n\n    # Render PDF with margins applied to every page\n    try:\n        pdf_bytes = await render_resume_pdf(url, pageSize, margins=pdf_margins)\n    except PDFRenderError as e:\n        raise HTTPException(status_code=503, detail=str(e))\n\n    headers = {\"Content-Disposition\": f'attachment; filename=\"resume_{resume_id}.pdf\"'}\n    return Response(content=pdf_bytes, media_type=\"application/pdf\", headers=headers)\n\n\n@router.delete(\"/{resume_id}\")\nasync def delete_resume(resume_id: str) -> dict:\n    \"\"\"Delete a resume by ID.\"\"\"\n    if not await db.delete_resume(resume_id):\n        raise HTTPException(status_code=404, detail=\"Resume not found\")\n\n    return {\"message\": \"Resume deleted successfully\"}\n\n\n@router.post(\"/{resume_id}/retry-processing\", response_model=ResumeUploadResponse)\nasync def retry_processing(resume_id: str) -> ResumeUploadResponse:\n    \"\"\"Retry AI processing for a failed or stuck resume.\n","sourceCodeStart":1645,"sourceCodeEnd":1681,"githubUrl":"https://github.com/srbhr/Resume-Matcher/blob/116f9cc3b00e1ac91734a6c2679bf41ea64a0edc/apps/backend/app/routers/resumes.py#L1645-L1681","documentation":"HTTP 503 raised by download_resume_pdf when the headless-browser PDF renderer throws PDFRenderError; the exception message (str(e)) becomes the response detail. Signals the PDF rendering service could not complete, typically a browser/Chromium launch or page-load failure.","triggerScenarios":"render_resume_pdf fails because Chromium is not installed or crashed, the print URL is unreachable from the renderer, page load times out, or renderer resource limits (memory) are hit on large resumes.","commonSituations":"Missing playwright/puppeteer browser binaries in the container image, sandbox flags missing in restricted environments (Docker/CI), print page deployment mismatch so the renderer URL 404s, or cold-start timeouts on serverless.","solutions":["Read the 503 detail/str(e) and server logs to identify the renderer failure (browser missing, URL unreachable, timeout)","Install the required browser binaries (e.g. `playwright install chromium`) in the deployment image","Verify the print page URL is reachable from the renderer process and add required sandbox/no-sandbox flags","Retry the download; if timeouts recur, increase the renderer timeout or resume size limits"],"exampleFix":"# Dockerfile before: no browser installed\nRUN pip install -r requirements.txt\n# after\nRUN pip install -r requirements.txt\nRUN playwright install --with-deps chromium","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"async function downloadPdfWithRetry(resumeId, attempts = 3) {\n  for (let i = 0; i < attempts; i++) {\n    try { return await downloadResumePdf(resumeId); }\n    catch (e) {\n      if (e.status === 503 && i < attempts - 1) { await sleep(2000 * (i + 1)); continue; }\n      if (e.status === 503) throw new Error('PDF service unavailable: ' + e.detail);\n      throw e;\n    }\n  }\n}","preventionTips":["Ensure Chromium/playwright binaries are installed in deployment images","Set required sandbox flags (or --no-sandbox) in containers/CI","Verify the print page URL is deployed and reachable from the renderer","Add renderer timeouts and health checks; alert on 503s"],"tags":["http-503","pdf-render","headless-browser","infrastructure"],"backgroundTag":"pdf-render-failed","analyzedSha":"116f9cc3b00e1ac91734a6c2679bf41ea64a0edc","analyzedAt":"2026-08-28T22:51:40.999Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}