{"record":{"id":"adcaab567321d340","repo":"odysseus-dev/odysseus","slug":"page-out-of-range","errorCode":null,"errorMessage":"Page out of range","messagePattern":"Page out of range","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"routes/document/document_routes.py","lineNumber":1224,"sourceCode":"        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:\n            pdf_doc.close()\n\n    # ---- POST /api/document/{doc_id}/ai-fill-annotations ----\n    @router.post(\"/api/document/{doc_id}/ai-fill-annotations\")\n    async def ai_fill_annotations(doc_id: str, request: Request) -> Dict[str, Any]:\n        \"\"\"Ask a vision-capable LLM to locate fillable areas on a flat PDF and\n        propose annotation values for each, given a free-form user instruction.\n","sourceCodeStart":1206,"sourceCodeEnd":1242,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/document/document_routes.py#L1206-L1242","documentation":"Error \"Page out of range\" 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":["Request a page number within the PDF's actual page count.","Check the document page count first and clamp the requested page index."],"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-15T22:17:37.221Z"}