{"record":{"id":"30ed33d636d067ec","repo":"invoke-ai/InvokeAI","slug":"video-concat-requires-at-least-two-input-videos","errorCode":null,"errorMessage":"video_concat requires at least two input videos.","messagePattern":"video_concat requires at least two input videos\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/video_concat.py","lineNumber":118,"sourceCode":"        default=\"cut\",\n        description=\"Transition between consecutive clips.\",\n    )\n    transition_frames: int = InputField(\n        default=8,\n        ge=0,\n        le=240,\n        description=\"Length of each transition in frames. Ignored when transition is 'cut'.\",\n    )\n    fps: Optional[int] = InputField(\n        default=None,\n        ge=1,\n        le=120,\n        description=\"Output frame rate. Defaults to the first input's fps.\",\n    )\n\n    def invoke(self, context: InvocationContext) -> VideoOutput:\n        if len(self.videos) < 2:\n            raise ValueError(\"video_concat requires at least two input videos.\")\n\n        paths: list[Path] = [context.videos.get_path(v.video_name) for v in self.videos]\n\n        # Probe inputs up front: enforce matching dims and pick the default output fps.\n        probes = [probe_video(p) for p in paths]\n        widths = {(w, h) for (w, h, _, _) in probes}\n        if len(widths) > 1:\n            raise ValueError(\n                f\"All inputs must share the same dimensions. Got: \"\n                f\"{sorted(widths)}. Re-render at a single resolution before concatenating.\"\n            )\n        width, height, _, _first_fps = probes[0]\n        # libx264 + yuv420p needs even dimensions; we encode with macro_block_size=1 to\n        # preserve the source dimensions exactly, so reject odd sources with a clear error.\n        if width % 2 or height % 2:\n            raise ValueError(\n                f\"Input videos are {width}x{height}; H.264 encoding requires even dimensions. \"\n                \"Re-encode or crop the sources to even width and height first.\"","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/video_concat.py#L100-L136","documentation":"The video_concat invocation requires at least two input videos to concatenate. Invoking it with fewer than two entries in self.videos raises ValueError immediately.","triggerScenarios":"Invoking VideoConcat with videos=[] or a single-element list.","commonSituations":"An upstream node failed and returned an empty collection that was fed into video_concat; a workflow where the second video's output was disconnected; user building a graph with one clip expecting passthrough.","solutions":["Provide at least two videos in the videos list","Fix the upstream node producing an empty/single video collection","Use the video node directly instead of video_concat when only one clip is needed"],"exampleFix":"// before\nvideos=[video_a]\n// after\nvideos=[video_a, video_b]","handlingStrategy":"validation","validationCode":"if len(videos) < 2:\n    raise ValueError(\"video_concat needs at least 2 videos; got %d\" % len(videos))\n# alternatively: pass through the single video unchanged","typeGuard":"def can_concat(videos: list) -> bool:\n    return len(videos) >= 2","tryCatchPattern":"try:\n    output = concat.invoke(context)\nexcept ValueError as e:\n    if \"at least two input videos\" in str(e):\n        output = passthrough_single_video(videos[0]) if len(videos) == 1 else None\n    else:\n        raise","preventionTips":["Check upstream nodes actually produced collections before wiring video_concat","Guard your workflow graph so empty collections skip the concat node","Only use video_concat for genuine multi-clip joins"],"tags":["validation","invokeai","video"],"backgroundTag":"insufficient-inputs","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}