{"record":{"id":"7d377ec7d0a5a598","repo":"srbhr/Resume-Matcher","slug":"pdf-rendering-failed-please-try-again-or-try-a-s","errorCode":null,"errorMessage":"PDF rendering failed. Please try again, or try a simpler resume or a different template.","messagePattern":"PDF rendering failed\\. Please try again, or try a simpler resume or a different template\\.","errorType":"exception","errorClass":"PDFRenderError","httpStatus":null,"severity":"error","filePath":"apps/backend/app/pdf.py","lineNumber":252,"sourceCode":"        raise PDFRenderError(\n            \"Playwright browser executable is missing or out of date. \"\n            \"Command shown for reference; quote the path if it contains spaces: \"\n            f\"{command}\"\n        ) from error\n    if \"net::ERR_CONNECTION_REFUSED\" in error_msg:\n        raise PDFRenderError(\n            f\"Cannot connect to frontend for PDF generation. \"\n            f\"Attempted URL: {url}. \"\n            f\"Please ensure: 1) The frontend is running, \"\n            f\"2) The FRONTEND_BASE_URL environment variable in the backend .env file \"\n            f\"matches the URL where your frontend is accessible.\"\n        ) from error\n    # Catch-all: the raw Playwright message can carry internal navigation URLs\n    # and a full call log. Log it server-side; return a generic message to the\n    # client (CLAUDE.md rule 5 — and it stops the verbose trace from overflowing\n    # the client error modal, #811).\n    logger.error(\"PDF rendering failed for %s: %s\", url, error_msg)\n    raise PDFRenderError(\n        \"PDF rendering failed. Please try again, or try a simpler resume or a \"\n        \"different template.\"\n    ) from error\n\n\ndef _loop_supports_subprocess() -> bool:\n    if sys.platform != \"win32\":\n        return True\n    try:\n        loop = asyncio.get_running_loop()\n    except RuntimeError:\n        return True\n    return loop.__class__.__name__ == \"ProactorEventLoop\"\n\n\nasync def close_pdf_renderer() -> None:\n    \"\"\"Close the Playwright browser instance.\"\"\"\n    global _playwright, _browser","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/srbhr/Resume-Matcher/blob/116f9cc3b00e1ac91734a6c2679bf41ea64a0edc/apps/backend/app/pdf.py#L234-L270","documentation":"Catch-all PDFRenderError raised by _raise_playwright_error for any PlaywrightError that is neither a missing executable nor connection-refused. The raw Playwright message (which can contain internal navigation URLs and a full call log) is logged server-side; the client gets a generic message to avoid leaking internals and overflowing the error modal.","triggerScenarios":"render_resume_pdf's Playwright call raises any other PlaywrightError — e.g. navigation timeout, page crash, renderer OOM, target closed, or an extremely large/complex resume exceeding rendering limits.","commonSituations":"Very large resumes or heavy templates timing out the default navigation timeout; headless Chromium crashing in memory-constrained containers; SSL/other navigation failures; transient driver crashes under concurrent PDF renders.","solutions":["Check backend logs for the full server-side error (logger.error records the raw Playwright message)","Retry the request — transient crashes/timeouts often succeed on a second attempt","Simplify the resume content or switch to a simpler template to reduce render cost","Increase Playwright timeouts / page.goto wait settings if renders are consistently slow","Raise container memory limits or run renders in a queue to reduce concurrent Chromium load"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"def is_generic_render_failure(err: Exception) -> bool:\n    msg = str(err)\n    return not (\"Executable doesn't exist\" in msg or \"net::ERR_CONNECTION_REFUSED\" in msg)","typeGuard":null,"tryCatchPattern":"try:\n    pdf = await render_resume_pdf(url, selector)\nexcept PDFRenderError as e:\n    if \"PDF rendering failed\" in str(e):\n        show_user_toast(\"PDF render failed — try again or simplify the resume\")\n    else:\n        raise","preventionTips":["Set generous but bounded Playwright timeouts in the renderer config","Monitor server logs (the raw Playwright message is logged there) for recurring crash patterns","Right-size container memory for headless Chromium","Queue PDF renders to limit concurrent browser instances","Keep templates light; test large resumes in CI"],"tags":["pdf","playwright","timeout","crash"],"backgroundTag":"headless-browser-render-failure","analyzedSha":"116f9cc3b00e1ac91734a6c2679bf41ea64a0edc","analyzedAt":"2026-08-28T22:51:40.999Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}