{"record":{"id":"9a9195bd4ea18d0c","repo":"ATH-MaaS/Pixelle-Video","slug":"image-file-not-found-image-path-9a9195","errorCode":null,"errorMessage":"Image file not found: {image_path}","messagePattern":"Image file not found: (.+?)","errorType":"validation","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"pixelle_video/services/image_analysis.py","lineNumber":113,"sourceCode":"            \n            # Use local ComfyUI\n            description = await pixelle_video.image_analysis(\n                \"temp/06.JPG\",\n                source=\"selfhost\"\n            )\n            \n            # Use specific workflow (bypass source-based resolution)\n            description = await pixelle_video.image_analysis(\n                \"temp/06.JPG\",\n                workflow=\"selfhost/custom_analysis.json\"\n            )\n        \"\"\"\n        from pixelle_video.utils.workflow_util import resolve_workflow_path\n        \n        # 1. Validate image path\n        image_path_obj = Path(image_path)\n        if not image_path_obj.exists():\n            raise FileNotFoundError(f\"Image file not found: {image_path}\")\n        \n        # 2. Resolve workflow path using convention\n        if workflow is None:\n            # Use standardized naming: {source}/analyse_image.json\n            workflow = resolve_workflow_path(\"analyse_image\", source)\n            logger.info(f\"Using {source} workflow: {workflow}\")\n        \n        # 2. Resolve workflow (returns structured info)\n        workflow_info = self._resolve_workflow(workflow=workflow)\n        \n        # 3. Build workflow parameters\n        workflow_params = {\n            \"image\": str(image_path)  # Pass image path to workflow\n        }\n        \n        # Add any additional parameters\n        workflow_params.update(params)\n        ","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/ATH-MaaS/Pixelle-Video/blob/848b054e4fae40dabc62ec58e960b573e83793ac/pixelle_video/services/image_analysis.py#L95-L131","documentation":"ImageAnalysisService.__call__ raises FileNotFoundError after checking Path(image_path).exists() before it does anything else. It is a fail-fast precondition: the service refuses to run an image-analysis workflow when the input image on disk does not exist at the exact path given.","triggerScenarios":"Calling the analyzer (e.g. await image_analysis(image_path='...', source='selfhost')) with a path that does not exist on the filesystem — typo in filename, wrong directory, relative path resolved from a different CWD, or a file deleted between selection and execution.","commonSituations":"Path built by string concatenation without os.path.join; running the app from a different working directory than during development; upstream pipeline passed a placeholder like None or 'output.png' from a failed generation step; case-sensitivity mismatch on Linux mounts.","solutions":["Print/verify the absolute path with Path(image_path).resolve() and confirm the file exists there","Fix the code that constructs the path (use pathlib relative to a known base dir, not CWD-dependent relative paths)","Confirm the upstream media-generation step actually wrote the file before analysis runs","Add an upfront existence check in the caller and surface a user-friendly message"],"exampleFix":"// before\nawait analyzer(image_path=\"outputs/frame.png\", source=\"selfhost\")\n// after\nfrom pathlib import Path\np = Path(\"outputs\").resolve() / \"frame.png\"\nif not p.exists():\n    raise FileNotFoundError(f\"Missing frame: {p}\")\nawait analyzer(image_path=str(p), source=\"selfhost\")","handlingStrategy":"validation","validationCode":"from pathlib import Path\ndef validate_image_path(p: str) -> bool:\n    path = Path(p)\n    return path.is_file() and path.stat().st_size > 0","typeGuard":"def is_existing_file(p: str | None) -> Path | None:\n    if p and Path(p).is_file():\n        return Path(p)\n    return None","tryCatchPattern":"try:\n    desc = await analyzer(image_path=str(img), source=src)\nexcept FileNotFoundError as e:\n    logger.error(f\"skip analysis, missing image: {e}\")\n    desc = None","preventionTips":["Always resolve to absolute paths with Path(...).resolve() before passing in","Run the existence check immediately after the upstream generation step produces the file","Avoid CWD-relative paths in configs; anchor them to a project/data root","Watch for case-sensitivity differences on Linux deployments"],"tags":["python","file-not-found","input-validation"],"backgroundTag":"file-not-found","analyzedSha":"848b054e4fae40dabc62ec58e960b573e83793ac","analyzedAt":"2026-08-30T03:24:41.468Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}