{"record":{"id":"4f444d57d311f015","repo":"Comfy-Org/ComfyUI","slug":"spatial-and-temporal-padding-modes-must-be-equal","errorCode":null,"errorMessage":"spatial and temporal padding modes must be equal","messagePattern":"spatial and temporal padding modes must be equal","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"comfy/ldm/lightricks/vae/conv_nd_factory.py","lineNumber":24,"sourceCode":"import comfy.ops\nops = comfy.ops.disable_weight_init\n\ndef make_conv_nd(\n    dims: Union[int, Tuple[int, int]],\n    in_channels: int,\n    out_channels: int,\n    kernel_size: int,\n    stride=1,\n    padding=0,\n    dilation=1,\n    groups=1,\n    bias=True,\n    causal=False,\n    spatial_padding_mode=\"zeros\",\n    temporal_padding_mode=\"zeros\",\n):\n    if not (spatial_padding_mode == temporal_padding_mode or causal):\n        raise NotImplementedError(\"spatial and temporal padding modes must be equal\")\n    if dims == 2:\n        return ops.Conv2d(\n            in_channels=in_channels,\n            out_channels=out_channels,\n            kernel_size=kernel_size,\n            stride=stride,\n            padding=padding,\n            dilation=dilation,\n            groups=groups,\n            bias=bias,\n            padding_mode=spatial_padding_mode,\n        )\n    elif dims == 3:\n        if causal:\n            return CausalConv3d(\n                in_channels=in_channels,\n                out_channels=out_channels,\n                kernel_size=kernel_size,","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/ldm/lightricks/vae/conv_nd_factory.py#L6-L42","documentation":"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.","triggerScenarios":"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.","commonSituations":"Porting configs that mix replicate spatial padding with zero temporal padding; forgetting to set causal=True when experimenting with padding modes.","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"],"exampleFix":"# before\nconv = make_conv_nd(3, c_in, c_out, 3, causal=False, spatial_padding_mode=\"replicate\", temporal_padding_mode=\"zeros\")\n\n# after\nconv = make_conv_nd(3, c_in, c_out, 3, causal=False, spatial_padding_mode=\"zeros\", temporal_padding_mode=\"zeros\")","handlingStrategy":"validation","validationCode":"if not causal and spatial_padding_mode != temporal_padding_mode:\n    raise ValueError(\"non-causal convs require spatial_padding_mode == temporal_padding_mode\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set both padding modes to the same value unless causal=True","Keep padding-mode config fields consistent in VAE configs"],"tags":["convolution","padding","video-vae","ltx"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}