{"record":{"id":"737826325eaae543","repo":"odysseus-dev/odysseus","slug":"not-an-image","errorCode":null,"errorMessage":"Not an image","messagePattern":"Not an image","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"routes/upload_routes.py","lineNumber":472,"sourceCode":"        Cached under UPLOAD_DIR/.vision/{file_id}.txt — first call computes,\n        subsequent loads are instant. Pass force=1 to recompute.\"\"\"\n        if not upload_handler.validate_upload_id(file_id):\n            raise HTTPException(400, \"Invalid file ID\")\n        info = _load_upload_info(file_id)\n        auth_mgr = getattr(request.app.state, \"auth_manager\", None)\n        auth_configured = bool(auth_mgr and auth_mgr.is_configured)\n        current_user = effective_user(request)\n        file_owner = info.get(\"owner\") if info else None\n        if auth_configured:\n            if not current_user:\n                raise HTTPException(403, \"Access denied\")\n            if file_owner != current_user and not auth_mgr.is_admin(current_user):\n                raise HTTPException(404, \"File not found\")\n        path = _resolve_upload_path(file_id)\n        import mimetypes as _mt\n        mime = (info or {}).get(\"mime\") or _mt.guess_type(path)[0] or \"\"\n        if not mime.startswith(\"image/\"):\n            raise HTTPException(400, \"Not an image\")\n        cache_path = _vision_cache_path(file_id)\n        if not force and os.path.exists(cache_path):\n            try:\n                with open(cache_path, encoding=\"utf-8\") as f:\n                    cached_text = f.read()\n                _sync_gallery_caption_for_upload(info, file_owner or current_user, cached_text)\n                return {\"text\": cached_text, \"cached\": True}\n            except Exception as e:\n                logger.warning(f\"Vision cache read failed for {file_id}: {e}\")\n        from src.document_processor import analyze_image_with_vl\n        try:\n            text = analyze_image_with_vl(path, owner=current_user) or \"\"\n        except Exception as e:\n            logger.error(f\"Vision analysis failed for {file_id}: {e}\")\n            raise HTTPException(500, f\"Vision analysis failed: {e}\")\n        try:\n            with open(cache_path, \"w\", encoding=\"utf-8\") as f:\n                f.write(text)","sourceCodeStart":454,"sourceCodeEnd":490,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/upload_routes.py#L454-L490","documentation":"Error \"Not an image\" 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":["Pass the id of an image upload.","Upload the file as an image type first."],"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"}