{"record":{"id":"647ba70ad9e5e326","repo":"ATH-MaaS/Pixelle-Video","slug":"image-file-not-found-image-path","errorCode":null,"errorMessage":"Image file not found: {image_path}","messagePattern":"Image file not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"pixelle_video/services/api_asset_analysis.py","lineNumber":99,"sourceCode":"                    \"provider\": provider,\n                    \"model\": model,\n                    \"media_type\": \"asset_analysis\",\n                    \"ability_type\": \"vlm_asset_analysis\",\n                    \"ability_types\": [\"vlm_asset_analysis\"],\n                })\n\n        return models\n\n    async def analyze_image(\n        self,\n        image_path: str,\n        model: Optional[str] = None,\n        prompt: Optional[str] = None,\n        **_: object,\n    ) -> str:\n        image_file = Path(image_path)\n        if not image_file.exists():\n            raise FileNotFoundError(f\"Image file not found: {image_path}\")\n\n        return await self._query_vlm(\n            prompt=prompt or self.IMAGE_PROMPT,\n            image_paths=[str(image_file)],\n            model=model,\n        )\n\n    async def analyze_video(\n        self,\n        video_path: str,\n        model: Optional[str] = None,\n        prompt: Optional[str] = None,\n        **_: object,\n    ) -> str:\n        video_file = Path(video_path)\n        if not video_file.exists():\n            raise FileNotFoundError(f\"Video file not found: {video_path}\")\n","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/ATH-MaaS/Pixelle-Video/blob/848b054e4fae40dabc62ec58e960b573e83793ac/pixelle_video/services/api_asset_analysis.py#L81-L117","documentation":"analyze_image checks Path(image_path).exists() before sending the file to the VLM API and raises FileNotFoundError when it does not exist on disk. This is a pre-flight check so the API call is not wasted on a missing file.","triggerScenarios":"Calling analyze_image (directly or through the asset-analysis __call__ from setup_environment) with a path that doesn't exist: deleted temp files, relative paths resolved from the wrong working directory, or stale asset entries.","commonSituations":"Temporary upload directories cleaned before analysis; using a URL instead of a local file path; running the service from a different CWD so relative paths break; files moved between upload and pipeline execution.","solutions":["Verify the path exists before calling: Path(image_path).exists()","Pass absolute paths (Path(image_path).resolve()) instead of relative ones","Re-run the upload step if the temp file was cleaned up; do not pass URLs to a local-file API","Check the service's working directory if relative paths are involved"],"exampleFix":"# before\nawait analyzer.analyze_image(\"uploads/cat.jpg\")  # relative, CWD changed\n# after\nfrom pathlib import Path\np = Path(\"uploads/cat.jpg\").resolve()\nif not p.exists():\n    raise FileNotFoundError(p)\nawait analyzer.analyze_image(str(p))","handlingStrategy":"validation","validationCode":"from pathlib import Path\np = Path(image_path)\nif not p.is_file():\n    raise FileNotFoundError(f\"image missing before analysis: {p}\")","typeGuard":"def image_exists(path: str) -> bool:\n    return Path(path).is_file()","tryCatchPattern":"try:\n    desc = await analyzer.analyze_image(image_path)\nexcept FileNotFoundError:\n    desc = await reupload_and_analyze(image_path)","preventionTips":["Store absolute resolved paths at upload time and pass those through the pipeline","Check file existence before each stage that consumes an asset","Don't clean temp upload directories while a task is still running"],"tags":["file-not-found","filesystem","validation"],"backgroundTag":"file-not-found","analyzedSha":"848b054e4fae40dabc62ec58e960b573e83793ac","analyzedAt":"2026-08-30T03:24:41.468Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}