OpenBMB/ChatDev · error · ValueError

No video files to concatenate

Error message

No video files to concatenate

What it means

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.

Source

Thrown at functions/function_calling/video.py:62

        # shutil.rmtree(output_dir, ignore_errors=True)
        raise RuntimeError(error_info)

    # Find valid mp4 files where no parent directory contains a partial_movie_files folder
    video_file = None
    for mp4_file in (Path.cwd() / "media" / "videos").parent.rglob("*.mp4"):
        if mp4_file.name == f"{scene_name}.mp4":
            video_file = mp4_file
            break

    target_path = script_path.parent / video_file.name
    print(f"Copying video to {target_path}")
    shutil.copy2(video_file, target_path)
    shutil.rmtree(output_dir, ignore_errors=True)
    return target_path

def concat_videos(video_paths: list[Path]) -> Path:
    if not video_paths:
        raise ValueError("No video files to concatenate")

    video_paths = [Path(p).resolve() for p in video_paths]
    output_path = video_paths[0].parent / "combined_video.mp4"

    with tempfile.NamedTemporaryFile(mode="w", suffix=".txt", delete=False) as f:
        for p in video_paths:
            f.write(f"file '{p.as_posix()}'\n")
        list_file = f.name

    cmd = [
        "ffmpeg",
        "-y",
        "-f", "concat",
        "-safe", "0",
        "-i", list_file,
        "-c", "copy",
        str(output_path)
    ]

View on GitHub (pinned to 4fb2db0ea9)

Solutions

  1. Check the upstream step actually produced video files before calling concat_videos
  2. Filter/validate the list: raise or skip when empty instead of passing it through
  3. Verify file extensions/naming match what your glob or collection logic expects

Example fix

# before
combined = concat_videos(video_paths)

# after
if not video_paths:
    raise RuntimeError('video generation step produced no outputs')
combined = concat_videos(video_paths)
Defensive patterns

Strategy: validation

Validate before calling

if not video_paths:
    raise RuntimeError('upstream produced no videos')
combined = concat_videos(video_paths)

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of OpenBMB/ChatDev@4fb2db0ea9 (2026-08-27). Data as JSON: /api/errors/5985d4677c7ae359. Report an issue: GitHub.