Comfy-Org/ComfyUI · error · ValueError
SeedVR2 VAE cache size {cache_size} exceeds input length {in
Error message
SeedVR2 VAE cache size {cache_size} exceeds input length {input[i].size(2)}. What it means
In basic (non-memory-limited) forward with multiple input slices, the conv keeps an overlap cache between slices. get_cache_size computes the required overlap from kernel/stride/dilation; if that cache is bigger than the current input slice (even after prepending the previous cache), the loop cannot proceed and raises. The cause is slices smaller than the conv's receptive-field overlap — typically from a caller that chunked the input too finely.
Source
Thrown at comfy/ldm/seedvr/vae.py:653
if cache_size > input[-1].size(2) and cache is not None and len(input) == 1:
input[0] = torch.cat([cache, input[0]], dim=2)
cache = None
if cache_size <= input[-1].size(2):
memory_cache[self] = input[-1][:, :, -cache_size:].detach().contiguous()
padding = tuple(x for x in reversed(self.padding) for _ in range(2))
for i in range(len(input)):
next_cache = None
cache_size = 0
if i < len(input) - 1:
cache_len = cache.size(2) if cache is not None else 0
cache_size = get_cache_size(self, input[i].size(2) + cache_len, pad_len=0)
if cache_size != 0:
if cache_size > input[i].size(2) and cache is not None:
input[i] = torch.cat([cache, input[i]], dim=2)
cache = None
if cache_size > input[i].size(2):
raise ValueError(f"SeedVR2 VAE cache size {cache_size} exceeds input length {input[i].size(2)}.")
next_cache = input[i][:, :, -cache_size:]
input[i] = self.memory_limit_conv(
input[i],
padding=padding,
prev_cache=cache
)
cache = next_cache
return input[0] if squeeze_out else input
def remove_head(tensor: Tensor, times: int = 1) -> Tensor:
if times == 0:
return tensor
return torch.cat(tensors=(tensor[:, :, :1], tensor[:, :, times + 1 :]), dim=2)
class Upsample3D(nn.Module):View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Feed larger chunks: at minimum dilated_kernel_size frames per slice in the temporal dimension.
- Avoid slicing for short inputs — pass the whole clip in one slice.
- Pad the temporal dimension (repeat first/last frame) to reach a valid length before the conv.
- Audit upstream code that performs manual temporal chunking and align chunk size to conv kernel.
Example fix
# before chunks = torch.split(vid, 2, dim=2) # kernel 3 -> cache exceeds slice # after chunks = torch.split(vid, 8, dim=2) # chunk >= dilated kernel size
Defensive patterns
Strategy: validation
Validate before calling
def validate_chunks(chunks, conv):
dilated = conv.dilation[0] * (conv.kernel_size[0] - 1) + 1
min_len = dilated - conv.stride[0] + 1
for c in chunks:
if c.size(2) < min_len:
raise ValueError(f"chunk len {c.size(2)} < minimum {min_len} for this conv")
return chunks Prevention
- Chunk temporal inputs in sizes of at least the dilated kernel length.
- Do not slice very short clips at all.
- Pad short clips by repeating boundary frames to a valid length.
When it happens
Trigger: Calling the multi-slice conv forward with input chunks shorter than dilated_kernel - stride + 1; extremely short video inputs split across slices; upstream code splitting temporal dimension into 1-2 frame chunks for stride-2 temporal convs.
Common situations: Processing 1-2 frame clips through a video VAE with temporal kernel 3; custom batchers that split by arbitrary frame counts; trimming videos to very short lengths.
Related errors
- SeedVR2 VAE cache size {next_cache_size} exceeds split size
- SeedVR2 VAE cache input is too short for convolution: input_
- SeedVR2 patch input temporal size must satisfy T % {t} == 1,
- SeedVR2 VAE convolution requires an explicit MemoryState.
- SeedVR2 upsample expected {self.channels} channels, got {hid
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/66e10e35dda1e17e.
Report an issue: GitHub.