Comfy-Org/ComfyUI · error · ValueError

MiniMax Music3 generated zero audio frames

Error message

MiniMax Music3 generated zero audio frames

What it means

Raised by MiniMax Music3's generation loop when it finishes without producing any audio frames — the stop token appeared before the first audio code was committed (or the pending first frame was a stop). It is a post-loop invariant check: the AR decoder emitted '<|audio_end|>' immediately, so there is nothing to decode into audio.

Source

Thrown at comfy/ldm/minimax_music/ar.py:342

            feedback_codes = depth_io["codes"]
            depth_hidden = depth_io["depth_hidden"]
            frame_hidden = torch.cat((last_hidden[:1].detach(), depth_hidden), dim=-1)
            if frame_index > 0:
                pending_hidden = frame_hidden[0].clone()

            feedback = self._embed_audio_frame(feedback_codes, execution_dtype)
            output = self.model(None, embeds=feedback, past_key_values=past, dtype=execution_dtype)
            last_hidden = output[0][:, -1]
            past = output[2]

        if pending_hidden is not None and len(hidden_frames) < decode_limit:
            if pending_event is not None:
                pending_event.synchronize()
            if int(pending_code.item()) != stop_token:
                hidden_frames.append(pending_hidden)

        if not hidden_frames:
            raise ValueError("MiniMax Music3 generated zero audio frames")
        return torch.stack(hidden_frames).to(device="cpu")

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Retry with a different seed and a moderate cfg_scale (near the default CFG_SCALE)
  2. Verify the prompt template is well-formed (caption/lyrics sections and <|audio_start|> present)
  3. Run validate_tokenizer on the tokenizer to confirm special token ids match what the model expects
Defensive patterns

Strategy: retry

Try / catch

try:
    frames = generate(...)
except ValueError as e:
    if 'zero audio frames' in str(e):
        # degenerate stop: resample with a new seed and default cfg
        frames = generate(..., seed=new_seed, cfg_scale=CFG_SCALE)
    else:
        raise

Prevention

When it happens

Trigger: The first sampled code equals the stop token, or generation is constrained (vocab_mask/cfg) so the model immediately ends audio; extremely high/low cfg_scale or a degenerate prompt can make the stop token the argmax.

Common situations: Malformed prompt templates (missing <|audio_start|>), cfg_scale far out of range, a different tokenizer/special-token mapping, or a prompt that is all padding/CFG tokens so the model ends audio instantly.

Related errors


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