Comfy-Org/ComfyUI · error · NotImplementedError
spatial and temporal padding modes must be equal
Error message
spatial and temporal padding modes must be equal
What it means
Raised by make_conv_nd in conv_nd_factory.py when spatial_padding_mode differs from temporal_padding_mode while causal=False. In the non-causal 3D path a single padding_mode applies to the whole Conv3d, so spatial and temporal modes must agree; mixed modes are only expressible in the causal DualConv3d path.
Source
Thrown at comfy/ldm/lightricks/vae/conv_nd_factory.py:24
import comfy.ops
ops = comfy.ops.disable_weight_init
def make_conv_nd(
dims: Union[int, Tuple[int, int]],
in_channels: int,
out_channels: int,
kernel_size: int,
stride=1,
padding=0,
dilation=1,
groups=1,
bias=True,
causal=False,
spatial_padding_mode="zeros",
temporal_padding_mode="zeros",
):
if not (spatial_padding_mode == temporal_padding_mode or causal):
raise NotImplementedError("spatial and temporal padding modes must be equal")
if dims == 2:
return ops.Conv2d(
in_channels=in_channels,
out_channels=out_channels,
kernel_size=kernel_size,
stride=stride,
padding=padding,
dilation=dilation,
groups=groups,
bias=bias,
padding_mode=spatial_padding_mode,
)
elif dims == 3:
if causal:
return CausalConv3d(
in_channels=in_channels,
out_channels=out_channels,
kernel_size=kernel_size,View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Set spatial_padding_mode == temporal_padding_mode (usually both 'zeros')
- Or pass causal=True so the DualConv3d path, which supports separate modes, is selected
- Check both padding-mode fields in the VAE config for accidental divergence
Example fix
# before conv = make_conv_nd(3, c_in, c_out, 3, causal=False, spatial_padding_mode="replicate", temporal_padding_mode="zeros") # after conv = make_conv_nd(3, c_in, c_out, 3, causal=False, spatial_padding_mode="zeros", temporal_padding_mode="zeros")
Defensive patterns
Strategy: validation
Validate before calling
if not causal and spatial_padding_mode != temporal_padding_mode:
raise ValueError("non-causal convs require spatial_padding_mode == temporal_padding_mode") Prevention
- Set both padding modes to the same value unless causal=True
- Keep padding-mode config fields consistent in VAE configs
When it happens
Trigger: Calling make_conv_nd(dims=3, padding_mode-ish args with spatial_padding_mode='replicate', temporal_padding_mode='zeros', causal=False), or constructing a non-causal video VAE whose config sets different spatial/temporal padding modes.
Common situations: Porting configs that mix replicate spatial padding with zero temporal padding; forgetting to set causal=True when experimenting with padding modes.
Related errors
- unsupported dimensions: {dims}
- unknown block: {block_name}
- Invalid latent_log_var: {latent_log_var}
- Invalid input shape: {sample.shape}
- unknown layer: {block_name}
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/4f444d57d311f015.
Report an issue: GitHub.