odysseus-dev/odysseus · error · HTTPException
Source PDF not found
Error message
Source PDF not found
What it means
Error "Source PDF not found" thrown in odysseus-dev/odysseus.
Source
Thrown at routes/document/document_routes.py:1216
async def render_page_png(doc_id: str, page_no: int, request: Request):
"""Render one page of the source PDF as a PNG (no values stamped — the
frontend overlays HTML form inputs on top)."""
from fastapi.responses import Response
from src.pdf_form_doc import find_source_upload_id
user = get_current_user(request)
db = SessionLocal()
try:
doc = db.query(Document).filter(Document.id == doc_id).first()
if not doc:
raise HTTPException(404, "Document not found")
_verify_doc_owner(db, doc, user)
upload_id = find_source_upload_id(doc.current_content or "")
if not upload_id:
raise HTTPException(400, "Document is not linked to a source PDF")
pdf_path = _locate_current_user_upload(request, upload_id, user)
if not pdf_path:
raise HTTPException(404, "Source PDF not found")
finally:
db.close()
fitz = _load_pdf_viewer_fitz()
pdf_doc = fitz.open(pdf_path)
try:
if page_no < 1 or page_no > pdf_doc.page_count:
raise HTTPException(404, "Page out of range")
page = pdf_doc[page_no - 1]
mat = fitz.Matrix(_PDF_RENDER_SCALE, _PDF_RENDER_SCALE)
pix = page.get_pixmap(matrix=mat, alpha=False)
png_bytes = pix.tobytes("png")
return Response(
content=png_bytes,
media_type="image/png",
headers={"Cache-Control": "public, max-age=3600"},
)
finally:View on GitHub (pinned to f9235ebbf1)
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.
When it happens
Trigger: 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.
Common situations: See trigger scenarios.
AI-assisted analysis of odysseus-dev/odysseus@f9235ebbf1 (2026-08-14).
Data as JSON: /api/errors/4e8c2f4842550ddc.
Report an issue: GitHub.