{"record":{"id":"8e70dff86ccae606","repo":"sgl-project/sglang","slug":"sana-wm-streaming-requires-positive-prompt-embeds","errorCode":null,"errorMessage":"SANA-WM streaming requires positive prompt embeds.","messagePattern":"SANA-WM streaming 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/streaming.py","lineNumber":465,"sourceCode":"        # is for the dense path; using it here ran CFG=4.5 vs the reference's none.\n        cfg_scale = sampler_cfg.streaming_cfg_scale\n        do_cfg = bool(batch.do_classifier_free_guidance) and cfg_scale > 1.0\n        if server_args.enable_cfg_parallel and do_cfg:\n            raise NotImplementedError(\n                \"SANA-WM streaming does not support CFG parallel; run replicated.\"\n            )\n\n        # --- text conditioning ---\n        pos_embeds = _to_device_dtype(\n            _first_tensor(pcfg.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 streaming requires positive prompt embeds.\")\n        neg_embeds = neg_mask = None\n        if do_cfg:\n            neg_embeds = _to_device_dtype(\n                _first_tensor(pcfg.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(\n                    \"SANA-WM streaming CFG requires negative prompt embeds.\"\n                )\n            pos_embeds, neg_embeds, pos_mask, neg_mask = (\n                _align_sana_wm_cfg_text_conditions(\n                    pos_embeds, neg_embeds, pos_mask, neg_mask\n                )","sourceCodeStart":447,"sourceCodeEnd":483,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/streaming.py#L447-L483","documentation":"_resolve_stream_conditioning requires positive prompt embeds (pcfg.get_pos_prompt_embeds(batch)) for every streaming forward. If the text-encoding stage did not populate them, text conditioning is impossible and the stage raises immediately.","triggerScenarios":"Running the streaming denoiser without the prompt-encoding stage in the pipeline, or the encoder failing to attach pos prompt embeds to the Req; empty-prompt requests where embeds were skipped rather than encoded as empty.","commonSituations":"Pipeline misordering (denoiser before text encoder); prompt field absent in the request so downstream embeds are None; batch.extra dropping embeds during transfer.","solutions":["Run the text-encoding stage before the streaming denoiser so pos prompt embeds exist","Ensure every request carries a prompt (even an empty string) that gets encoded","Validate pcfg.get_pos_prompt_embeds(batch) is not None before dispatch"],"exampleFix":"# before\nresp = streaming_stage.forward(batch, server_args)  # no embeds\n# after\nbatch = text_encode_stage.forward(batch, server_args)  # sets pos prompt embeds\nresp = streaming_stage.forward(batch, server_args)","handlingStrategy":"validation","validationCode":"if pcfg.get_pos_prompt_embeds(batch) is None:\n    batch = text_encode_stage.forward(batch, server_args)\nassert pcfg.get_pos_prompt_embeds(batch) is not None","typeGuard":"def has_pos_embeds(pcfg, batch) -> bool:\n    return pcfg.get_pos_prompt_embeds(batch) is not None","tryCatchPattern":"null","preventionTips":["Make text encoding precede denoising in every pipeline variant","Default empty prompts to encoded empty strings","Integration-test the minimal happy path after any pipeline edit"],"tags":["sana-wm","streaming","prompt-embeds","conditioning","valueerror"],"backgroundTag":"missing-pipeline-input","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}