Comfy-Org/ComfyUI · error · ValueError
MiniMax H3 supports batch size 1
Error message
MiniMax H3 supports batch size 1
What it means
Raised in MiniMax H3's _forward when the video latent batch dimension is not 1. The model packs video and audio latents into a single PackedLayout keyed by (text_len, latent_t, lat_h, lat_w, audio_t) and its layout/attention code assumes exactly one sequence, so batching is not implemented. Any batched prompt fails fast with this ValueError.
Source
Thrown at comfy/ldm/minimax/model.py:539
out = comfy.patcher_extension.WrapperExecutor.new_class_executor(
self._forward,
self,
comfy.patcher_extension.get_all_wrappers(comfy.patcher_extension.WrappersMP.DIFFUSION_MODEL, transformer_options)
).execute(x, timestep, context, transformer_options, minimax_payload=minimax_payload, **kwargs)
if scale != 1.0:
# d/d(sigma_v) of the carried variable
out[1] = ((1.0 - scale) * (audio_src * carry)
+ (1.0 + (scale - 1.0) * sigma_a).to(out[1].dtype) * out[1])
return out
def _forward(self, x, timestep, context, transformer_options={}, minimax_payload=None, **kwargs):
video_x, audio_x = x[0], x[1]
orig_t, orig_h, orig_w = video_x.shape[2], video_x.shape[3], video_x.shape[4]
video_x = comfy.ldm.common_dit.pad_to_patch_size(video_x, self.patch_size)
if video_x.shape[0] != 1:
raise ValueError("MiniMax H3 supports batch size 1")
payload = minimax_payload or {}
device = video_x.device
dtype = context.dtype # compute dtype
latent_t, lat_h, lat_w = video_x.shape[2], video_x.shape[3], video_x.shape[4]
audio_t = audio_x.shape[-1]
text_len = context.shape[1]
# extra_conds prebuilds the layout once per sampling run
layout = payload.get("layout")
if layout is None or layout.signature != (text_len, latent_t, lat_h, lat_w, audio_t):
layout = PackedLayout(text_len, latent_t, lat_h, lat_w, audio_t,
keyframes=payload.get("keyframes"),
refs=payload.get("refs"))
# model_base passes model_sampling.timestep(sigma) = sigma * 1000
shift_v = float(transformer_options.get("minimax_h3_sigma_shift_video", self.sigma_shift_video))
shift_a = float(transformer_options.get("minimax_h3_sigma_shift_audio", self.sigma_shift_audio))
sigma_v = (timestep.flatten()[0] / 1000.0).float().clamp(min=1e-6)View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Set batch size to 1 for MiniMax H3 runs
- Loop over prompts sequentially instead of batching
- Check the workflow for nodes between the sampler and the model that expand the latent batch dimension
Example fix
# before video_latent = video_latent.repeat(2, 1, 1, 1, 1) # batch of 2 out = model((video_latent, audio_latent), t, ctx) # after video_latent = video_latent[0:1] # batch of 1 out = model((video_latent, audio_latent), t, ctx)
Defensive patterns
Strategy: validation
Validate before calling
assert video_latent.shape[0] == 1, f'MiniMax H3 requires batch size 1, got {video_latent.shape[0]}' Prevention
- Check latent batch dims right after any node that could broadcast/repeat latents
- Keep MiniMax H3 workflows at batch_size 1 and loop externally for multiple prompts
When it happens
Trigger: Calling the MiniMax H3 diffusion model's forward with video_x.shape[0] != 1 — e.g. batch size 2+, or accidentally leaving a batch dimension of size >1 after splitting/merging latents in a workflow.
Common situations: Setting batch_size > 1 in a ComfyUI workflow that includes the MiniMax H3 node; batching prompts for throughput; a latent-broadcast operation silently expanding the batch dim before the model call.
Related errors
- SeedVR2 expected {name} to be 5-D native latent, got shape {
- {type(model).__name__} must implement map_context_window_to_
- Passing a list or tuple of seeds to BatchedBrownianTree requ
- ar_video sampler requires 5-D video latents [B,C,T,H,W], got
- MiniMax Music3 prompt has {prompt_tokens} tokens; maximum is
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/7ea0649247406b83.
Report an issue: GitHub.