ATH-MaaS/Pixelle-Video · error · FileNotFoundError

参考图片不存在: {reference_image_path}

Error message

参考图片不存在: {reference_image_path}

What it means

generate_video validates the optional reference_image_path (a single reference image guiding content/subject) and raises FileNotFoundError when the file is absent. Fail-fast before the API call.

Source

Thrown at pixelle_video/services/api_services/video_dashscope.py:186

        Returns:
            video_url: 远端视频 URL

        Raises:
            FileNotFoundError: 输入图片不存在
            RuntimeError: API 调用或下载失败
        """
        if VideoSynthesis is None:
            raise RuntimeError("dashscope package not installed. Run: pip install dashscope")

        if image_path and not os.path.exists(image_path):
            raise FileNotFoundError(f"输入图片不存在: {image_path}")
        if last_image_path and not os.path.exists(last_image_path):
            raise FileNotFoundError(f"尾帧图片不存在: {last_image_path}")
        if first_clip_path and not os.path.exists(first_clip_path):
            raise FileNotFoundError(f"输入视频片段不存在: {first_clip_path}")
        if reference_image_path and not os.path.exists(reference_image_path):
            raise FileNotFoundError(f"参考图片不存在: {reference_image_path}")
        for ref_image_path in reference_image_paths or []:
            if ref_image_path and not os.path.exists(ref_image_path):
                raise FileNotFoundError(f"参考图片不存在: {ref_image_path}")
        for ref_video_path in reference_video_paths or []:
            if ref_video_path and not os.path.exists(ref_video_path):
                raise FileNotFoundError(f"参考视频不存在: {ref_video_path}")
        if reference_audio_path and not os.path.exists(reference_audio_path):
            raise FileNotFoundError(f"参考音频不存在: {reference_audio_path}")
        if audio_path and not os.path.exists(audio_path):
            raise FileNotFoundError(f"驱动音频不存在: {audio_path}")

        logger.info(f"DashscopeVideoClient: model={model}, prompt={prompt[:60]}...")

        if self._is_text_to_video_model(model):
            call_kwargs = {
                "api_key": self.api_key,
                "model": model,
                "prompt": prompt,

View on GitHub (pinned to 848b054e4f)

Solutions

  1. os.path.exists(reference_image_path) pre-check and fix the path or re-provide the image
  2. Re-upload / re-download the reference image if it was lost
  3. Compare exact filename casing on the filesystem (Linux is case-sensitive)
  4. Log the resolved absolute path being passed to spot config errors

Example fix

// before
client.generate_video(prompt, reference_image_path='refs/subject.jpg')  # FileNotFoundError
// after
ref = 'refs/subject.jpg'
if not os.path.exists(ref):
    raise ValueError(f"Provide a valid reference image, got missing: {ref}")
client.generate_video(prompt, reference_image_path=ref)
Defensive patterns

Strategy: validation

Validate before calling

import os
if reference_image_path and not os.path.isfile(reference_image_path):
    raise FileNotFoundError(f'参考图片不存在: {reference_image_path}')

Type guard

def is_existing_file(path) -> bool:
    return isinstance(path, str) and os.path.isfile(path)

Try / catch

try:
    video = client.generate_video(prompt, reference_image_path=ref)
except FileNotFoundError as e:
    logging.error(f'Reference image missing: {e}')
    video = None  # or retry without the reference

Prevention

When it happens

Trigger: generate_video(..., reference_image_path='ref.jpg', ...) where ref.jpg does not exist on disk.

Common situations: Reference image uploaded by a user but stored under a different name; object-storage downloaded copy deleted; case-sensitive filesystem mismatch (Ref.JPG vs ref.jpg on Linux); incorrect mount path.

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/463607c7f97269c4. Report an issue: GitHub.