sgl-project/sglang · error · RuntimeError

Cosmos3 action request produced no action tensor

Error message

Cosmos3 action request produced no action tensor

What it means

After a Cosmos3 forward for a request whose data_type is DataType.ACTION, the predicted action tensor (action_pred) is None. This means the model loop never emitted an action sample (e.g. action denoising path silently skipped or a tensor-shape/branch bug), and the runtime raises rather than returning a malformed payload.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/cosmos3.py:1696

                )
            self.log_info(f"Action predictions shape: {tuple(action_pred.shape)}")

        action_domain_ids = batch.extra.get("action_domain_ids")
        action_domain_id = (
            int(action_domain_ids[0].item()) if action_domain_ids is not None else None
        )
        action_metadata = {
            "action_mode": getattr(batch.sampling_params, "action_mode", None),
            "action_domain_id": action_domain_id,
            "action_raw_action_dim": (
                batch.extra.get("raw_action_dim")
                if getattr(batch, "extra", None)
                else None
            ),
        }
        if batch.data_type == DataType.ACTION:
            if action_pred is None:
                raise RuntimeError("Cosmos3 action request produced no action tensor")
            payload_actions = (
                action_pred[0] if action_pred.shape[0] == 1 else action_pred
            )
            payload = {
                "request_id": batch.request_id,
                "actions": payload_actions.numpy(),
                "action_mode": action_metadata["action_mode"],
                "domain_id": action_metadata["action_domain_id"],
                "raw_action_dim": action_metadata["action_raw_action_dim"],
                "parameters": {
                    "num_inference_steps": batch.num_inference_steps,
                    "num_frames": batch.num_frames,
                },
            }
            return OutputBatch(
                output=[payload],
                action_pred=action_pred,
                metrics=batch.metrics if hasattr(batch, "metrics") else None,

View on GitHub (pinned to 0132848349)

Solutions

  1. Check that the action scheduler actually ran: verify action sampling steps > 0 and the action branch of forward executed
  2. Ensure request/action latents were prepared (_prepare_action_latents path) and data_type is set before forward
  3. If it reproduces, capture a minimal request and report with scheduler config — this indicates an internal routing bug
Defensive patterns

Strategy: try-catch

Try / catch

try:
    result = stage.forward(batch)
except RuntimeError as e:
    if "produced no action tensor" in str(e):
        logger.error("action routing bug for request %s; dumping scheduler config", batch.request_id)
        raise
    raise

Prevention

When it happens

Trigger: batch.data_type == DataType.ACTION but forward's denoising/sampling loop produced no action tensor — e.g. the action scheduler branch was skipped, num_steps=0 for the action scheduler, or an upstream flag routed the request through the video-only path.

Common situations: Misconfigured pipeline_config action settings; a code path change where action generation is gated behind a flag that wasn't set; version regression after refactor of the unified forward.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/3c8b958773009a72. Report an issue: GitHub.