{"record":{"id":"5985d4677c7ae359","repo":"OpenBMB/ChatDev","slug":"no-video-files-to-concatenate","errorCode":null,"errorMessage":"No video files to concatenate","messagePattern":"No video files to concatenate","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"functions/function_calling/video.py","lineNumber":62,"sourceCode":"        # shutil.rmtree(output_dir, ignore_errors=True)\n        raise RuntimeError(error_info)\n\n    # Find valid mp4 files where no parent directory contains a partial_movie_files folder\n    video_file = None\n    for mp4_file in (Path.cwd() / \"media\" / \"videos\").parent.rglob(\"*.mp4\"):\n        if mp4_file.name == f\"{scene_name}.mp4\":\n            video_file = mp4_file\n            break\n\n    target_path = script_path.parent / video_file.name\n    print(f\"Copying video to {target_path}\")\n    shutil.copy2(video_file, target_path)\n    shutil.rmtree(output_dir, ignore_errors=True)\n    return target_path\n\ndef concat_videos(video_paths: list[Path]) -> Path:\n    if not video_paths:\n        raise ValueError(\"No video files to concatenate\")\n\n    video_paths = [Path(p).resolve() for p in video_paths]\n    output_path = video_paths[0].parent / \"combined_video.mp4\"\n\n    with tempfile.NamedTemporaryFile(mode=\"w\", suffix=\".txt\", delete=False) as f:\n        for p in video_paths:\n            f.write(f\"file '{p.as_posix()}'\\n\")\n        list_file = f.name\n\n    cmd = [\n        \"ffmpeg\",\n        \"-y\",\n        \"-f\", \"concat\",\n        \"-safe\", \"0\",\n        \"-i\", list_file,\n        \"-c\", \"copy\",\n        str(output_path)\n    ]","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/OpenBMB/ChatDev/blob/4fb2db0ea90375ce1059f44fe03ffbd191a7a169/functions/function_calling/video.py#L44-L80","documentation":"Raised by concat_videos when the video_paths list is empty. The function needs at least one input video to build an ffmpeg concat file and produce combined_video.mp4, so an empty list is rejected immediately.","triggerScenarios":"Calling concat_videos([]) or concat_videos(video_paths=[]) directly, or passing a list comprehension/glob result that matched no files (e.g. list of *.mp4 downloads that were cleaned up or named differently).","commonSituations":"Video-generation pipelines where upstream nodes produced no artifacts (all failed or saved with unexpected extensions), or glob patterns that match nothing; also when a preceding step returns an empty list on failure instead of raising.","solutions":["Check the upstream step actually produced video files before calling concat_videos","Filter/validate the list: raise or skip when empty instead of passing it through","Verify file extensions/naming match what your glob or collection logic expects"],"exampleFix":"# before\ncombined = concat_videos(video_paths)\n\n# after\nif not video_paths:\n    raise RuntimeError('video generation step produced no outputs')\ncombined = concat_videos(video_paths)","handlingStrategy":"validation","validationCode":"if not video_paths:\n    raise RuntimeError('upstream produced no videos')\ncombined = concat_videos(video_paths)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate non-empty inputs before calling","Log the count of upstream artifacts before concatenation"],"tags":["video","ffmpeg","concatenation","validation"],"backgroundTag":"empty-input-list","analyzedSha":"4fb2db0ea90375ce1059f44fe03ffbd191a7a169","analyzedAt":"2026-08-27T14:35:29.622Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}