OpenBMB/VoxCPM · warning

Retry on bad cases is not supported in streaming mode, setti

Error message

Retry on bad cases is not supported in streaming mode, setting retry_badcase=False.

What it means

Bad-case retry re-runs generation when the audio/text length ratio looks wrong; this is impossible when chunks are already yielded in streaming mode, so voxcpm emits a UserWarning and silently forces retry_badcase=False.

Source

Thrown at src/voxcpm/model/voxcpm.py:376

    @torch.inference_mode()
    def _generate(
        self,
        target_text: str,
        prompt_text: str = "",
        prompt_wav_path: str = "",
        min_len: int = 2,
        max_len: int = 2000,
        inference_timesteps: int = 10,
        cfg_value: float = 2.0,
        retry_badcase: bool = False,
        retry_badcase_max_times: int = 3,
        retry_badcase_ratio_threshold: float = 6.0,  # setting acceptable ratio of audio length to text length (for badcase detection)
        streaming: bool = False,
        seed: Optional[int] = None,
    ) -> Generator[torch.Tensor, None, None]:
        if retry_badcase and streaming:
            warnings.warn("Retry on bad cases is not supported in streaming mode, setting retry_badcase=False.")
            retry_badcase = False
        if len(prompt_wav_path) == 0:
            text = target_text
            text_token = torch.LongTensor(self.text_tokenizer(text))
            text_token = torch.cat(
                [
                    text_token,
                    torch.tensor(
                        [self.audio_start_token],
                        dtype=torch.int32,
                        device=text_token.device,
                    ),
                ],
                dim=-1,
            )
            text_length = text_token.shape[0]

            audio_feat = torch.zeros(

View on GitHub (pinned to f5a1c6a6b9)

Solutions

  1. Explicitly pass retry_badcase=False with streaming=True to silence the warning and document intent
  2. If bad-case protection matters, use non-streaming generate with retry_badcase=True
  3. Filter/handle the UserWarning at the call site if noise matters

Example fix

# before
for chunk in model.generate_streaming(text, ...):
    ...
# after
for chunk in model._generate(..., streaming=True, retry_badcase=False):
    ...
Defensive patterns

Strategy: validation

Validate before calling

if streaming:
    retry_badcase = False  # avoid the warning and be explicit

Prevention

When it happens

Trigger: Calling generate/_generate with streaming=True and retry_badcase=True (the default), producing warnings.warn output.

Common situations: Service wrapping the streaming API with default args; users surprised that streamed audio can occasionally have bad length without retry.

Related errors


AI-assisted analysis of OpenBMB/VoxCPM@f5a1c6a6b9 (2026-08-27). Data as JSON: /api/errors/2c461c08a3c241be. Report an issue: GitHub.