{"record":{"id":"be1b18b446139733","repo":"sgl-project/sglang","slug":"sana-wm-denoising-requires-positive-prompt-embeds","errorCode":null,"errorMessage":"SANA-WM denoising requires positive prompt embeds.","messagePattern":"SANA-WM denoising requires positive prompt embeds\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/base.py","lineNumber":861,"sourceCode":"        if timesteps is None:\n            raise ValueError(\"SANA-WM denoising requires prepared timesteps.\")\n        timesteps = timesteps.to(device=device)\n\n        latents = batch.latents.to(device=device, dtype=target_dtype)\n        init_latents = latents.clone()\n        condition_mask = torch.zeros_like(latents)\n        condition_mask[:, :, :1] = 1\n\n        pos_embeds = _to_device_dtype(\n            _first_tensor(server_args.pipeline_config.get_pos_prompt_embeds(batch)),\n            device=device,\n            dtype=target_dtype,\n        )\n        pos_mask = _to_device_dtype(\n            _first_tensor(batch.prompt_attention_mask), device=device\n        )\n        if pos_embeds is None:\n            raise ValueError(\"SANA-WM denoising requires positive prompt embeds.\")\n\n        do_cfg = bool(batch.do_classifier_free_guidance)\n        neg_embeds = None\n        neg_mask = None\n        if do_cfg:\n            neg_embeds = _to_device_dtype(\n                _first_tensor(server_args.pipeline_config.get_neg_prompt_embeds(batch)),\n                device=device,\n                dtype=target_dtype,\n            )\n            neg_mask = _to_device_dtype(\n                _first_tensor(batch.negative_attention_mask), device=device\n            )\n            if neg_embeds is None:\n                raise ValueError(\"SANA-WM CFG requires negative prompt embeds.\")\n\n            pos_embeds, neg_embeds, pos_mask, neg_mask = (\n                _align_sana_wm_cfg_text_conditions(","sourceCodeStart":843,"sourceCodeEnd":879,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/base.py#L843-L879","documentation":"Raised by the SANA-WM denoising forward when the positive prompt embeds are None — the text-encoder stage did not produce prompt embeddings on the batch.","triggerScenarios":"Running denoising when batch prompt embeds (e.g. batch.prompt_embeds / equivalent) are missing, because the stage-1 text encoder stage did not run or failed to attach embeds.","commonSituations":"Text encoder stage skipped or run after denoising; prompt was empty and embeds were never generated; field name mismatch leaving embeds unset.","solutions":["Ensure the stage-1 Gemma-2 text encoding stage runs before denoising","Verify the prompt is non-empty and embeds are attached to the batch","Check for silent failures in the text encoder stage logs"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"assert _first_tensor(batch.prompt_embeds) is not None","typeGuard":"def has_prompt_embeds(batch) -> bool:\n    return getattr(batch, 'prompt_embeds', None) is not None","tryCatchPattern":null,"preventionTips":["Run the text-encoder stage before denoising in every pipeline config","Fail fast on empty prompts at ingestion"],"tags":["prompt-embeds","pipeline-order","sana-wm"],"backgroundTag":"missing-prerequisite-state","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}