{"record":{"id":"4e8c2f4842550ddc","repo":"odysseus-dev/odysseus","slug":"source-pdf-not-found","errorCode":null,"errorMessage":"Source PDF not found","messagePattern":"Source PDF not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"routes/document/document_routes.py","lineNumber":1216,"sourceCode":"    async def render_page_png(doc_id: str, page_no: int, request: Request):\n        \"\"\"Render one page of the source PDF as a PNG (no values stamped — the\n        frontend overlays HTML form inputs on top).\"\"\"\n        from fastapi.responses import Response\n        from src.pdf_form_doc import find_source_upload_id\n\n        user = get_current_user(request)\n        db = SessionLocal()\n        try:\n            doc = db.query(Document).filter(Document.id == doc_id).first()\n            if not doc:\n                raise HTTPException(404, \"Document not found\")\n            _verify_doc_owner(db, doc, user)\n            upload_id = find_source_upload_id(doc.current_content or \"\")\n            if not upload_id:\n                raise HTTPException(400, \"Document is not linked to a source PDF\")\n            pdf_path = _locate_current_user_upload(request, upload_id, user)\n            if not pdf_path:\n                raise HTTPException(404, \"Source PDF not found\")\n        finally:\n            db.close()\n\n        fitz = _load_pdf_viewer_fitz()\n        pdf_doc = fitz.open(pdf_path)\n        try:\n            if page_no < 1 or page_no > pdf_doc.page_count:\n                raise HTTPException(404, \"Page out of range\")\n            page = pdf_doc[page_no - 1]\n            mat = fitz.Matrix(_PDF_RENDER_SCALE, _PDF_RENDER_SCALE)\n            pix = page.get_pixmap(matrix=mat, alpha=False)\n            png_bytes = pix.tobytes(\"png\")\n            return Response(\n                content=png_bytes,\n                media_type=\"image/png\",\n                headers={\"Cache-Control\": \"public, max-age=3600\"},\n            )\n        finally:","sourceCodeStart":1198,"sourceCodeEnd":1234,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/document/document_routes.py#L1198-L1234","documentation":"Error \"Source PDF not found\" thrown in odysseus-dev/odysseus.","triggerScenarios":"Triggered when the corresponding server-side validation or runtime check at the recorded location rejects the request or operation and returns this error message to the caller.","commonSituations":"See trigger scenarios.","solutions":["Verify the PDF upload id still exists in uploads before rendering its pages.","Re-import the source PDF if it was deleted, then retry the operation."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f9235ebbf13f693a6fd29ce70b097f6ec83705bf","analyzedAt":"2026-08-14T21:47:48.359Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}