{"record":{"id":"07878c238f5898b2","repo":"ATH-MaaS/Pixelle-Video","slug":"image-path-07878c","errorCode":null,"errorMessage":"输入图片不存在: {image_path}","messagePattern":"输入图片不存在: (.+?)","errorType":"validation","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"pixelle_video/services/api_services/video_seedance.py","lineNumber":94,"sourceCode":"        self._download_video(video_url, save_path)\n        \n        return video_url\n\n    def _submit_task(self, prompt: str, image_path: Optional[str], model: str, duration: int, **kwargs) -> str:\n        # 根据 Seedance 2.0 文档更新接口路径\n        url = f\"{self.base_url}/contents/generations/tasks\"\n\n        # 构建 content 数组\n        content = []\n        if prompt:\n            content.append({\n                \"type\": \"text\",\n                \"text\": prompt\n            })\n\n        if image_path:\n            if not os.path.exists(image_path):\n                raise FileNotFoundError(f\"输入图片不存在: {image_path}\")\n\n            with open(image_path, \"rb\") as f:\n                img_data = base64.b64encode(f.read()).decode(\"utf-8\")\n            ext = os.path.splitext(image_path)[1].lower()\n            mime = \"image/png\" if ext == \".png\" else \"image/jpeg\"\n            image_base64 = f\"data:{mime};base64,{img_data}\"\n\n            # 图生视频-首帧\n            content.append({\n                \"type\": \"image_url\",\n                \"image_url\": {\n                    \"url\": image_base64\n                },\n                \"role\": \"first_frame\"\n            })\n\n        payload = {\n            \"model\": model,","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/ATH-MaaS/Pixelle-Video/blob/848b054e4fae40dabc62ec58e960b573e83793ac/pixelle_video/services/api_services/video_seedance.py#L76-L112","documentation":"_submit_task throws FileNotFoundError when an image_path was supplied but no file exists at that path. Since the payload embeds the image as base64, the client must read it from disk first and refuses to proceed on a missing file.","triggerScenarios":"Calling generate_video(prompt=..., image_path='/path/to/img.jpg') where the path does not exist (or points to a directory/unreadable file that os.path.exists reports False for).","commonSituations":"Typo in filename; relative path resolved against a different working directory; image deleted or moved after a previous step; path with spaces/unescaped characters; passing a URL string instead of a local path.","solutions":["Check the file exists before calling: os.path.isfile(image_path)","Use an absolute path (os.path.abspath) so the check and the open() see the same file","If you have a URL, download it to a local file first — this client only accepts local paths","Print os.getcwd() and the resolved path to debug relative-path confusion"],"exampleFix":"// before\nclient.generate_video(prompt=\"...\", image_path=\"img.png\")\n// after\nimport os\nimg = os.path.abspath(\"img.png\")\nassert os.path.isfile(img), f\"missing image: {img}\"\nclient.generate_video(prompt=\"...\", image_path=img)","handlingStrategy":"validation","validationCode":"import os\np = os.path.abspath(image_path)\nif not os.path.isfile(p):\n    raise FileNotFoundError(f\"image missing: {p}\")","typeGuard":null,"tryCatchPattern":"try:\n    client.generate_video(prompt=p, image_path=image_path, save_path=out)\nexcept FileNotFoundError as e:\n    logging.error(f\"Input image missing: {e}\")","preventionTips":["Always pass absolute paths into generate_video","Assert os.path.isfile() immediately after any step that produces the image","Never pass URLs or data URLs where a local file path is required"],"tags":["file-not-found","input-validation","image"],"backgroundTag":"file-not-found","analyzedSha":"848b054e4fae40dabc62ec58e960b573e83793ac","analyzedAt":"2026-08-30T03:24:41.468Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}