Comfy-Org/ComfyUI · error · ValueError

unsupported dimensions: {dims}

Error message

unsupported dimensions: {dims}

What it means

Raised by make_conv_nd when dims is not one of 2, 3, or the (2,1) tuple (2D spatial + 1D temporal factorization via DualConv3d). The factory dispatches on these three shapes only; any other dims value is unsupported.

Source

Thrown at comfy/ldm/lightricks/vae/conv_nd_factory.py:72

            stride=stride,
            padding=padding,
            dilation=dilation,
            groups=groups,
            bias=bias,
            padding_mode=spatial_padding_mode,
        )
    elif dims == (2, 1):
        return DualConv3d(
            in_channels=in_channels,
            out_channels=out_channels,
            kernel_size=kernel_size,
            stride=stride,
            padding=padding,
            bias=bias,
            padding_mode=spatial_padding_mode,
        )
    else:
        raise ValueError(f"unsupported dimensions: {dims}")


def make_linear_nd(
    dims: int,
    in_channels: int,
    out_channels: int,
    bias=True,
):
    if dims == 2:
        return ops.Conv2d(
            in_channels=in_channels, out_channels=out_channels, kernel_size=1, bias=bias
        )
    elif dims == 3 or dims == (2, 1):
        return ops.Conv3d(
            in_channels=in_channels, out_channels=out_channels, kernel_size=1, bias=bias
        )
    else:
        raise ValueError(f"unsupported dimensions: {dims}")

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Pass dims=2 (2D), dims=3 (full 3D), or dims=(2,1) (2D+time factorized)
  2. Verify the checkpoint config's dims entry and its type before building the VAE
  3. Update ComfyUI if a newer model requires a new dims shape

Example fix

# before
conv = make_conv_nd(dims=1, ...)

# after
conv = make_conv_nd(dims=(2, 1), ...)
Defensive patterns

Strategy: validation

Validate before calling

if dims not in (2, 3, (2, 1)):
    raise ValueError(f"dims must be 2, 3, or (2,1), got {dims!r}")

Type guard

def is_supported_dims(d) -> bool:
    return d in (2, 3) or tuple(d) == (2, 1)

Prevention

When it happens

Trigger: Calling make_conv_nd(dims=1) or dims=(3,1), or constructing a video VAE whose dims config field holds an unexpected value. Often dims comes from a config like "dims": 3 for 3D VAEs or "dims": [2,1] for factorized ones.

Common situations: Checkpoint config with a missing/renamed dims field so it resolves to None or a string; new model variants introducing other factorizations; passing a list where the code expects int or (2,1).

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/cd23399ec3260c76. Report an issue: GitHub.