{"record":{"id":"457bcf72d7fcffaa","repo":"sgl-project/sglang","slug":"ltx-2-requires-audio-latents-for-denoising","errorCode":null,"errorMessage":"LTX-2 requires audio latents for denoising.","messagePattern":"LTX-2 requires audio latents for denoising\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/ltx_2/denoising.py","lineNumber":1717,"sourceCode":"        server_args: ServerArgs,\n        step_index: int,\n        t_int: int,\n        timesteps_cpu: torch.Tensor,\n    ):\n        \"\"\"Preserve the legacy LTX-2 attention-metadata contract.\"\"\"\n        # Legacy LTX-2 paths used the plain attention-metadata builder call here.\n        return self._build_attn_metadata(step_index, batch, server_args)\n\n    def _run_denoising_step(\n        self,\n        ctx: LTX2DenoisingContext,\n        step: DenoisingStepState,\n        batch: Req,\n        server_args: ServerArgs,\n    ) -> None:\n        \"\"\"Run one joint video/audio denoising step with LTX-2-specific guidance.\"\"\"\n        if ctx.audio_latents is None:\n            raise ValueError(\"LTX-2 requires audio latents for denoising.\")\n        if ctx.audio_scheduler is None:\n            raise ValueError(\"LTX-2 audio scheduler was not prepared.\")\n\n        # 1. Read the scheduler sigma pair and derive the Euler delta.\n        sigmas = getattr(ctx.scheduler, \"sigmas\", None)\n        if sigmas is None or not isinstance(sigmas, torch.Tensor):\n            raise ValueError(\"Expected scheduler.sigmas to be a tensor for LTX-2.\")\n        sigma = sigmas[step.step_index].to(\n            device=ctx.latents.device, dtype=torch.float32\n        )\n        sigma_next = sigmas[step.step_index + 1].to(\n            device=ctx.latents.device, dtype=torch.float32\n        )\n        dt = sigma_next - sigma\n        sigma_val = float(sigma.item())\n        sigma_next_val = float(sigma_next.item())\n\n        stage1_guider_params = self._get_ltx2_stage1_guider_params(","sourceCodeStart":1699,"sourceCodeEnd":1735,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/ltx_2/denoising.py#L1699-L1735","documentation":"Every LTX-2 denoising step jointly denoises video and audio, so ctx.audio_latents must be set. If the audio latents were never prepared (None), the step cannot proceed and raises immediately.","triggerScenarios":"Calling _run_denoising_step with ctx.audio_latents is None — audio VAE encode skipped, prompt lacking audio, or prep stage not populating the field.","commonSituations":"Text-only or video-only prompt passed to an LTX-2 pipeline expecting audio latents; upstream audio encoder failure leaving the field unset; request routing a non-audio request into the LTX-2 stage.","solutions":["Provide audio (or silence) input so the audio VAE produces audio latents into ctx.audio_latents","Verify the audio prep stage ran and assigns ctx.audio_latents for every request","Route requests without audio to a pipeline variant that doesn't require audio latents"],"exampleFix":"// before\nbatch.audio = None  # -> ctx.audio_latents stays None\n// after\nbatch.audio = batch.audio if batch.audio is not None else silence_clip(num_frames)","handlingStrategy":"validation","validationCode":"if ctx.audio_latents is None:\n    raise RuntimeError(\"audio latents missing: provide audio or route to non-audio pipeline\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default missing audio to a silence clip at request prep","Assert required ctx fields after preparation"],"tags":["ltx-2","audio-latents","required-input"],"backgroundTag":"missing-required-input","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}