ATH-MaaS/Pixelle-Video · error · FileNotFoundError

Image file not found: {image_path}

Error message

Image file not found: {image_path}

What it means

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.

Source

Thrown at pixelle_video/services/image_analysis.py:113

            
            # Use local ComfyUI
            description = await pixelle_video.image_analysis(
                "temp/06.JPG",
                source="selfhost"
            )
            
            # Use specific workflow (bypass source-based resolution)
            description = await pixelle_video.image_analysis(
                "temp/06.JPG",
                workflow="selfhost/custom_analysis.json"
            )
        """
        from pixelle_video.utils.workflow_util import resolve_workflow_path
        
        # 1. Validate image path
        image_path_obj = Path(image_path)
        if not image_path_obj.exists():
            raise FileNotFoundError(f"Image file not found: {image_path}")
        
        # 2. Resolve workflow path using convention
        if workflow is None:
            # Use standardized naming: {source}/analyse_image.json
            workflow = resolve_workflow_path("analyse_image", source)
            logger.info(f"Using {source} workflow: {workflow}")
        
        # 2. Resolve workflow (returns structured info)
        workflow_info = self._resolve_workflow(workflow=workflow)
        
        # 3. Build workflow parameters
        workflow_params = {
            "image": str(image_path)  # Pass image path to workflow
        }
        
        # Add any additional parameters
        workflow_params.update(params)
        

View on GitHub (pinned to 848b054e4f)

Solutions

  1. Print/verify the absolute path with Path(image_path).resolve() and confirm the file exists there
  2. Fix the code that constructs the path (use pathlib relative to a known base dir, not CWD-dependent relative paths)
  3. Confirm the upstream media-generation step actually wrote the file before analysis runs
  4. Add an upfront existence check in the caller and surface a user-friendly message

Example fix

// before
await analyzer(image_path="outputs/frame.png", source="selfhost")
// after
from pathlib import Path
p = Path("outputs").resolve() / "frame.png"
if not p.exists():
    raise FileNotFoundError(f"Missing frame: {p}")
await analyzer(image_path=str(p), source="selfhost")
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
def validate_image_path(p: str) -> bool:
    path = Path(p)
    return path.is_file() and path.stat().st_size > 0

Type guard

def is_existing_file(p: str | None) -> Path | None:
    if p and Path(p).is_file():
        return Path(p)
    return None

Try / catch

try:
    desc = await analyzer(image_path=str(img), source=src)
except FileNotFoundError as e:
    logger.error(f"skip analysis, missing image: {e}")
    desc = None

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of ATH-MaaS/Pixelle-Video@848b054e4f (2026-08-30). Data as JSON: /api/errors/9a9195bd4ea18d0c. Report an issue: GitHub.