{"record":{"id":"a13d2e5306c7f855","repo":"invoke-ai/InvokeAI","slug":"clip-i-has-n-frames-frames-but-the-requested-t","errorCode":null,"errorMessage":"Clip {i} has {n_frames} frames but the requested transitions need {head_want} from its head + {tail_keep} from its tail. Lower transition_frames or use longer clips.","messagePattern":"Clip (.+?) has (.+?) frames but the requested transitions need (.+?) from its head \\+ (.+?) from its tail\\. Lower transition_frames or use longer clips\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/video_concat.py","lineNumber":281,"sourceCode":"                # The clip's first head_want frames are consumed into the boundary blend\n                # with the previous clip's tail rather than emitted directly.\n                if not head_complete:\n                    b_head.append(frame)\n                    if len(b_head) == head_want and blend is not None:\n                        yield from blend(a_tail, b_head)\n                        a_tail = []\n                        b_head = []\n                        head_complete = True\n                    continue\n                # Hold back the last tail_keep frames seen so far; anything older is\n                # guaranteed not to be part of the next boundary and can be emitted.\n                tail_buf.append(frame)\n                if len(tail_buf) > tail_keep:\n                    yield tail_buf.popleft()\n            if n_frames == 0:\n                raise ValueError(f\"Input video {i} ({self.videos[i].video_name}) decoded to zero frames.\")\n            if n_frames < head_want + tail_keep:\n                raise ValueError(\n                    f\"Clip {i} has {n_frames} frames but the requested transitions need \"\n                    f\"{head_want} from its head + {tail_keep} from its tail. Lower \"\n                    f\"transition_frames or use longer clips.\"\n                )\n            a_tail = list(tail_buf)\n","sourceCodeStart":263,"sourceCodeEnd":287,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/video_concat.py#L263-L287","documentation":"Thrown when a clip has fewer frames than the sum of head_want and tail_keep required by the neighboring transitions. With transition_frames=tf, each clip must supply ~tf/2 frames at its head and tail for crossfades; short clips cannot support the requested transition. This is a hard validation to prevent index errors.","triggerScenarios":"invoke() -> _iter_joined_frames: after decoding video i, n_frames < head_want + tail_keep (roughly transition_frames at each boundary).","commonSituations":"Very short clips (e.g. 1-2 seconds) combined with large transition_frames; three-clip chains where the middle clip needs head+tail simultaneously.","solutions":["Lower transition_frames on the invocation","Use longer source clips","Remove the too-short clip from the chain","Trim fewer frames by switching boundary mode to 'cut' instead of crossfade"],"exampleFix":"// before\nVideoConcat(videos=[short_clip], transition_frames=48)  # clip has only 20 frames\n// after\nVideoConcat(videos=[short_clip], transition_frames=8)","handlingStrategy":"validation","validationCode":"n = decoder_frame_count(path)\nneed = transition_frames  # head + tail per boundary approx tf\nif n is not None and n < need:\n    raise ValueError(f'clip {name} too short: {n} frames < {need} needed')","typeGuard":null,"tryCatchPattern":"try:\n    out = concat.invoke(context)\nexcept ValueError as e:\n    if 'Lower transition_frames or use longer clips' in str(e):\n        tf = min(transition_frames, min_clip_frames // 2)\n        out = rebuild(transition_frames=tf).invoke(context)\n    else:\n        raise","preventionTips":["Ensure every clip length >= 2*transition_frames","Cap transition_frames dynamically from shortest clip duration","Avoid sub-second clips in crossfade chains"],"tags":["video","validation","frame-count"],"backgroundTag":"clip-too-short-for-transition","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}