{"record":{"id":"c419bb750f37125d","repo":"ATH-MaaS/Pixelle-Video","slug":"image-path","errorCode":null,"errorMessage":"输入图片不存在: {image_path}","messagePattern":"输入图片不存在: (.+?)","errorType":"validation","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"pixelle_video/services/api_services/video_dashscope.py","lineNumber":180,"sourceCode":"            first_clip_path: 可选首段视频本地路径（wan2.7 视频续写）\n            reference_image_path: 可选参考图片路径（videoedit）\n            reference_image_paths: 可选参考图片列表（r2v）\n            reference_video_paths: 可选参考视频列表（r2v）\n            reference_audio_path: 可选参考音频/音色路径（r2v）\n            audio_path: 可选驱动音频本地路径（wan2.7）\n\n        Returns:\n            video_url: 远端视频 URL\n\n        Raises:\n            FileNotFoundError: 输入图片不存在\n            RuntimeError: API 调用或下载失败\n        \"\"\"\n        if VideoSynthesis is None:\n            raise RuntimeError(\"dashscope package not installed. Run: pip install dashscope\")\n\n        if image_path and not os.path.exists(image_path):\n            raise FileNotFoundError(f\"输入图片不存在: {image_path}\")\n        if last_image_path and not os.path.exists(last_image_path):\n            raise FileNotFoundError(f\"尾帧图片不存在: {last_image_path}\")\n        if first_clip_path and not os.path.exists(first_clip_path):\n            raise FileNotFoundError(f\"输入视频片段不存在: {first_clip_path}\")\n        if reference_image_path and not os.path.exists(reference_image_path):\n            raise FileNotFoundError(f\"参考图片不存在: {reference_image_path}\")\n        for ref_image_path in reference_image_paths or []:\n            if ref_image_path and not os.path.exists(ref_image_path):\n                raise FileNotFoundError(f\"参考图片不存在: {ref_image_path}\")\n        for ref_video_path in reference_video_paths or []:\n            if ref_video_path and not os.path.exists(ref_video_path):\n                raise FileNotFoundError(f\"参考视频不存在: {ref_video_path}\")\n        if reference_audio_path and not os.path.exists(reference_audio_path):\n            raise FileNotFoundError(f\"参考音频不存在: {reference_audio_path}\")\n        if audio_path and not os.path.exists(audio_path):\n            raise FileNotFoundError(f\"驱动音频不存在: {audio_path}\")\n\n        logger.info(f\"DashscopeVideoClient: model={model}, prompt={prompt[:60]}...\")","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/ATH-MaaS/Pixelle-Video/blob/848b054e4fae40dabc62ec58e960b573e83793ac/pixelle_video/services/api_services/video_dashscope.py#L162-L198","documentation":"generate_video validates all input file paths up front and raises FileNotFoundError if the primary input image does not exist. This fail-fast check avoids sending a bad request to the API. Only raised when image_path was provided and os.path.exists returns False.","triggerScenarios":"generate_video(image_path='/path/img.png', ...) where that file does not exist — deleted file, wrong relative path, or path built from user input.","commonSituations":"Relative vs absolute path confusion (working directory differs in production); file generated by a previous pipeline step that failed silently; image uploaded later than the video call; container not mounting the volume containing the image.","solutions":["os.path.exists(image_path) check before calling and correct/resolve the path","Convert to absolute path (os.path.abspath / pathlib.Path.resolve) to avoid cwd mismatch","Ensure the upstream step that produces the image completed successfully","In containers, verify the directory is volume-mounted and readable"],"exampleFix":"// before\nclient.generate_video(prompt, image_path='outputs/img.png')  # FileNotFoundError\n// after\nfrom pathlib import Path\nimg = Path('outputs/img.png').resolve()\nassert img.exists(), f\"missing {img}\"\nclient.generate_video(prompt, image_path=str(img))","handlingStrategy":"validation","validationCode":"import os\nif image_path and not os.path.exists(image_path):\n    raise FileNotFoundError(f'输入图片不存在: {image_path}')","typeGuard":"def is_existing_file(path) -> bool:\n    return isinstance(path, str) and os.path.isfile(path)","tryCatchPattern":"try:\n    video = client.generate_video(prompt, image_path=image_path)\nexcept FileNotFoundError as e:\n    logging.error(f'Input image missing: {e}')\n    video = None  # or regenerate the image first","preventionTips":["Use absolute paths (pathlib.Path.resolve) to avoid cwd surprises","Verify upstream image-generation steps succeeded before video generation","Mount required volumes in containers and check permissions","Add pre-flight file existence assertions in pipelines"],"tags":["file-not-found","input-validation","path"],"backgroundTag":"file-not-found","analyzedSha":"848b054e4fae40dabc62ec58e960b573e83793ac","analyzedAt":"2026-08-30T03:24:41.468Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}