{"record":{"id":"4b8f0ce88dc6c0aa","repo":"sgl-project/sglang","slug":"conditioning-prompt-embeds-must-be-provided","errorCode":null,"errorMessage":"Conditioning (prompt_embeds) must be provided","messagePattern":"Conditioning \\(prompt_embeds\\) must be provided","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/hunyuan3d/shape.py","lineNumber":332,"sourceCode":"        freshly_loaded = load_transformer_if_needed(self, server_args)\n        if freshly_loaded:\n            self._maybe_enable_cache_dit(cache_dit_num_inference_steps, batch)\n            self._maybe_torch_compile(self.transformer)\n            register_loaded_transformer(self, server_args, pipeline)\n        else:\n            self._maybe_enable_cache_dit(cache_dit_num_inference_steps, batch)\n\n        timesteps = batch.timesteps\n        if timesteps is None:\n            raise ValueError(\"Timesteps must be provided\")\n\n        latents = batch.latents\n        if latents is None:\n            raise ValueError(\"Latents must be provided\")\n\n        cond = batch.prompt_embeds[0] if batch.prompt_embeds else None\n        if cond is None:\n            raise ValueError(\"Conditioning (prompt_embeds) must be provided\")\n\n        if batch.raw_latent_shape is None:\n            batch.raw_latent_shape = latents.shape\n\n        guidance = batch.extra.get(\"shape_guidance\")\n        num_inference_steps = batch.num_inference_steps\n        num_warmup_steps = len(timesteps) - num_inference_steps * scheduler.order\n\n        extra_step_kwargs = self.prepare_extra_func_kwargs(\n            scheduler.step,\n            {\"generator\": batch.generator, \"eta\": batch.eta},\n        )\n\n        target_dtype = next(self.transformer.parameters()).dtype\n        autocast_enabled = False\n\n        pos_cond_kwargs = {\"encoder_hidden_states\": cond}\n        neg_cond_kwargs = {}","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/hunyuan3d/shape.py#L314-L350","documentation":"The denoising loop needs conditioning embeddings (batch.prompt_embeds) produced by the image encoder stage from the input image. If prompt_embeds is empty or its first element is None, the DiT has no conditioning signal and the stage aborts. cond = batch.prompt_embeds[0] if batch.prompt_embeds else None.","triggerScenarios":"Running the denoising stage without the preceding image-encoding stage; the encoder stage produced an empty list; manual batch construction that skips prompt_embeds; image path invalid so encoder emitted nothing.","commonSituations":"Pipeline composition missing the image-encoder stage; upstream encoder silently failed (bad image, OOM) and forwarded an empty embedding list; test harness omitting embeddings; field renamed during refactor.","solutions":["Ensure the image/condition encoding stage runs before the Hunyuan3D denoising stage and writes batch.prompt_embeds","Check upstream encoder logs for silent failures (unloadable image, dtype/device errors) and fix those","Populate prompt_embeds manually in tests: batch.prompt_embeds = [encoder(image)]"],"exampleFix":"# before\nbatch.prompt_embeds = []\n\n# after\nbatch.prompt_embeds = [image_encoder.encode(pil_image)]  # non-empty tensor","handlingStrategy":"validation","validationCode":"if not batch.prompt_embeds or batch.prompt_embeds[0] is None:\n    raise ValueError(\"run image encoding stage first\") from None","typeGuard":"def has_conditioning(batch) -> bool:\n    pe = getattr(batch, \"prompt_embeds\", None)\n    return bool(pe) and pe[0] is not None","tryCatchPattern":null,"preventionTips":["Verify encoder stage output is non-empty before forwarding","Log embedding shapes at stage boundaries in debug builds"],"tags":["hunyuan3d","pipeline-order","missing-state","conditioning"],"backgroundTag":"pipeline-stage-ordering-error","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}