{"record":{"id":"45a19c8723620837","repo":"sgl-project/sglang","slug":"sana-wm-first-frame-conditioning-failed-refusing","errorCode":null,"errorMessage":"SANA-WM first-frame conditioning failed; refusing to continue with pure-noise latents because that produces misleading low-quality output.","messagePattern":"SANA-WM first-frame conditioning failed; refusing to continue with pure-noise latents because that produces misleading low-quality output\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/base.py","lineNumber":2262,"sourceCode":"\n        latent_shape = self.pipeline_config.prepare_latent_shape(\n            batch, batch_size, num_frames\n        )\n        # latent_shape: (B, 128, T_latent, H_sp, W_sp)\n        latents = self._prepare_noise_latents(latent_shape, dtype, device, generator)\n        log_sana_wm_tensor_stats(\"latents.initial_noise\", latents)\n\n        batch.raw_latent_shape = latent_shape\n\n        condition_image = getattr(batch, \"condition_image\", None)\n        if condition_image is not None:\n            try:\n                latents = self._splice_first_frame(\n                    latents, condition_image, dtype, device, batch=batch\n                )\n                self.log_info(\"First-frame spliced into noise latents.\")\n            except Exception as e:\n                raise RuntimeError(\n                    \"SANA-WM first-frame conditioning failed; refusing to \"\n                    \"continue with pure-noise latents because that produces \"\n                    \"misleading low-quality output.\"\n                ) from e\n        else:\n            raise ValueError(\n                \"SANA-WM is a TI2V world model and requires condition_image \"\n                \"for first-frame conditioning. Provide --image-path, \"\n                \"--condition-image, or the equivalent API image input.\"\n            )\n\n        batch.latents = latents\n\n        # The released SANA-WM checkpoint is camera-conditioned. Official\n        # inference requires a camera trajectory or action DSL. If the SGLang\n        # request omits one, use a static identity trajectory so the UCPE path\n        # remains active instead of silently dropping all camera conditioning.\n        try:","sourceCodeStart":2244,"sourceCodeEnd":2280,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/base.py#L2244-L2280","documentation":"SANA-WM splices the condition image into the initial noise latents for first-frame conditioning. If _splice_first_frame raises for any reason (decode failure, resolution mismatch, device/dtype issue), forward aborts rather than continuing with pure noise, which would silently produce garbage video.","triggerScenarios":"Any exception inside _splice_first_frame — corrupt/unsupported condition image, mismatched height/width vs generation config, VAE encode failure, OOM — wrapped into this RuntimeError with the original exception chained.","commonSituations":"Condition image resolution not matching the requested video height/width, malformed image paths, or CUDA OOM during the splice encode.","solutions":["Inspect the chained __cause__ exception to find the real failure.","Ensure the condition image is a valid tensor/PIL image sized to the requested video height/width.","Reduce batch/resolution if the cause is OOM.","Fix or re-encode the image, then retry the request."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if condition_image is None or not condition_image.isfinite().all():\n    raise ValueError('bad condition image')","typeGuard":null,"tryCatchPattern":"try:\n    out = stage.forward(...)\nexcept RuntimeError as e:\n    if 'first-frame conditioning failed' in str(e):\n        cause = e.__cause__  # real failure: resize/OOM/decode\n        handle(cause)\n    else:\n        raise","preventionTips":["Pre-resize the condition image to the requested height/width.","Monitor GPU memory before submitting large batches.","Always inspect e.__cause__, not just the wrapper message."],"tags":["sglang","sana-wm","first-frame-conditioning","fail-fast","runtime-wrapper"],"backgroundTag":"wrapped-chained-exception","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}