{"record":{"id":"992ad376ed7d35ad","repo":"ATH-MaaS/Pixelle-Video","slug":"api-video-generation-did-not-create-file-save-pa","errorCode":null,"errorMessage":"API video generation did not create file: {save_path}","messagePattern":"API video generation did not create file: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"pixelle_video/services/api_media.py","lineNumber":578,"sourceCode":"                    save_path=save_path,\n                    model=model,\n                    duration=safe_duration,\n                    video_ratio=ratio,\n                    **video_options,\n                )\n                break\n            except Exception as exc:\n                if attempt >= max_safety_retries or not self._is_content_inspection_error(exc):\n                    raise\n\n                logger.warning(\n                    \"API video generation failed content inspection; \"\n                    f\"neutralizing prompt and retrying once. provider={provider}, model={model}, error={exc}\"\n                )\n                prompt_to_use = await self._neutralize_video_prompt(prompt_to_use)\n\n        if not os.path.exists(save_path):\n            raise RuntimeError(f\"API video generation did not create file: {save_path}\")\n\n        return MediaResult(media_type=\"video\", url=save_path, duration=safe_duration)\n\n    def _is_content_inspection_error(self, exc: Exception) -> bool:\n        \"\"\"Return True when a provider rejects input because of content inspection.\"\"\"\n        message = str(exc).lower()\n        return any(\n            marker in message\n            for marker in (\n                \"datainspectionfailed\",\n                \"inappropriate content\",\n                \"green net check failed\",\n                \"content inspection\",\n                \"safety inspection\",\n                \"risk control\",\n            )\n        )\n","sourceCodeStart":560,"sourceCodeEnd":596,"githubUrl":"https://github.com/ATH-MaaS/Pixelle-Video/blob/848b054e4fae40dabc62ec58e960b573e83793ac/pixelle_video/services/api_media.py#L560-L596","documentation":"After the provider call (including a content-inspection retry with a neutralized prompt), _generate_video checks that the expected output file exists at save_path. If the provider reported success (or the failure path swallowed the error) but no file was written to disk, this RuntimeError is raised.","triggerScenarios":"Provider returns 200/no exception but fails to persist the video; the download/save step silently skips writing; save_path points to an unwritable or wrong directory; async task completed with no usable output.","commonSituations":"Disk full or permissions issue in save_dir; provider API change where the result URL is empty; network drop during final download; content-policy rejection that does not surface as an exception.","solutions":["Check save_path directory exists and is writable (os.makedirs, permissions)","Log the provider response to confirm a video URL/result was actually returned","Retry the generation; if content inspection is the cause, rephrase the prompt","Verify provider SDK version still writes the file in the expected location"],"exampleFix":"// before\nresult = await gen(prompt=p, output_path=None)\n// after\nos.makedirs(\"outputs/videos\", exist_ok=True)\nresult = await gen(prompt=p, output_path=\"outputs/videos/clip.mp4\")","handlingStrategy":"try-catch","validationCode":"save_path = output_path or default_path\nos.makedirs(os.path.dirname(save_path), exist_ok=True)\nif not os.access(os.path.dirname(save_path), os.W_OK):\n    raise PermissionError(f\"cannot write to {save_path}\")","typeGuard":null,"tryCatchPattern":"try:\n    result = await gen(prompt=p)\nexcept RuntimeError as e:\n    if \"did not create file\" in str(e):\n        logging.error(\"video missing at %s; provider response logged\", e)\n        result = await retry_gen(prompt=p)","preventionTips":["Pre-create and permission-check the output directory","Always pass an explicit output_path","Log the raw provider response for post-mortem"],"tags":["io","file-not-found","video-generation"],"backgroundTag":"output-file-missing","analyzedSha":"848b054e4fae40dabc62ec58e960b573e83793ac","analyzedAt":"2026-08-30T03:24:41.468Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}