{"record":{"id":"bdb27557704caace","repo":"sgl-project/sglang","slug":"ltx-2-audio-scheduler-was-not-prepared","errorCode":null,"errorMessage":"LTX-2 audio scheduler was not prepared.","messagePattern":"LTX-2 audio scheduler was not prepared\\.","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":1690,"sourceCode":"        # cfg-parallel batches are broadcast from rank 0; scheduler state must be local\n        for name in (\"sigmas\", \"timesteps\"):\n            value = getattr(scheduler, name, None)\n            if isinstance(value, torch.Tensor):\n                setattr(scheduler, name, value.to(device))\n\n    def _before_denoising_loop(\n        self, ctx: LTX2DenoisingContext, batch: Req, server_args: ServerArgs\n    ) -> None:\n        \"\"\"Reset the mirrored audio scheduler before the shared loop begins.\"\"\"\n        if is_ltx2_two_stage_pipeline_name(\n            server_args.pipeline_class_name\n        ) and ctx.stage in (\"stage1\", \"stage2\"):\n            pipeline = self.pipeline() if self.pipeline else None\n            if pipeline is not None:\n                pipeline.switch_lora_phase(ctx.stage, batch=batch)\n        super()._before_denoising_loop(ctx, batch, server_args)\n        if ctx.audio_scheduler is None:\n            raise ValueError(\"LTX-2 audio scheduler was not prepared.\")\n        ctx.audio_scheduler.set_begin_index(0)\n        if self.sampler_name == \"res2s\" and ctx.use_native_hq_res2s_sde_noise:\n            self._ltx2_init_res2s_noise_generators(ctx)\n\n    def _prepare_step_attn_metadata(\n        self,\n        ctx: LTX2DenoisingContext,\n        batch: Req,\n        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(","sourceCodeStart":1672,"sourceCodeEnd":1708,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/ltx_2/denoising.py#L1672-L1708","documentation":"_before_denoising_loop asserts that the LTX-2 audio scheduler (ctx.audio_scheduler) was constructed during preparation. LTX-2 does joint video+audio denoising, so a missing audio scheduler means the prep stage never ran or failed silently.","triggerScenarios":"ctx.audio_scheduler is None at loop start — e.g. the prepare stage skipped audio scheduler construction (audio disabled path, exception swallowed, or stage ordering changed).","commonSituations":"Running an LTX-2 pipeline variant with audio disabled but still entering the joint loop; a refactor reordering prepare vs loop stages; a config flag that skips audio init without skipping the LTX-2 stage.","solutions":["Ensure the LTX-2 prepare path that builds ctx.audio_scheduler runs before _before_denoising_loop","Check for config flags that disable audio-scheduler init and disable them or route to a non-LTX-2 stage","Grep for where audio_scheduler is assigned and confirm it isn't conditionally skipped for your request type"],"exampleFix":"// before\nctx.audio_scheduler = build_audio_scheduler(cfg) if enable_audio else None\n// after\nctx.audio_scheduler = build_audio_scheduler(cfg)  # required for LTX-2 stage\nassert ctx.audio_scheduler is not None","handlingStrategy":"validation","validationCode":"assert ctx.audio_scheduler is not None, \"audio scheduler missing; check prepare stage\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fail fast right after the prepare stage instead of at loop start","Don't add config paths that skip audio-scheduler construction for LTX-2"],"tags":["ltx-2","audio-scheduler","initialization","pipeline-ordering"],"backgroundTag":"missing-prerequisite-object","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}