sgl-project/sglang · error · RuntimeError

action policy returned no output

Error message

action policy returned no output

What it means

Raised by infer_action when the scheduler response completes without an error but `response.output` is None, i.e. the action policy produced no output for the request. This indicates an empty or truncated generation rather than a hard failure — the response object exists but has no action output to unpack (response.output[0]).

Source

Thrown at python/sglang/multimodal_gen/runtime/entrypoints/action/protocol.py:424

            server_args,
            sampling_params_cls,
        )
    raise ValueError(
        f"Action endpoint is not implemented for {sampling_params_cls.__name__}"
    )


async def infer_action(
    payload: dict[str, Any],
    server_args: ServerArgs,
) -> dict[str, Any]:
    sp = build_action_sampling_params(payload, server_args)
    req = prepare_request(server_args, sp)
    response = await async_scheduler_client.forward(req)
    if getattr(response, "error", None):
        raise RuntimeError(response.error)
    if response.output is None:
        raise RuntimeError("action policy returned no output")
    return response.output[0]


def action_generation_response(
    output: dict[str, Any],
    server_args: ServerArgs,
    *,
    preserve_numpy: bool = False,
) -> dict[str, Any]:
    actions = output["actions"]
    action_array = np.asarray(actions)
    if any(size == 0 for size in action_array.shape):
        raise ValueError(
            "action output dimensions must be non-zero, got "
            f"{tuple(action_array.shape)}"
        )
    if action_array.ndim == 2:
        action_array = action_array[None]

View on GitHub (pinned to 0132848349)

Solutions

  1. Verify the request payload (observations/prompts) is non-empty before calling infer_action
  2. Check sampling params (horizon, max tokens) built by build_action_sampling_params are non-zero
  3. Retry the request; if it persists, inspect scheduler logs to see why output was omitted
  4. Guard callers to surface a user-friendly message when output is missing instead of crashing
Defensive patterns

Strategy: validation

Validate before calling

if not payload.get("observations"):
    raise HTTPException(400, "observations must be non-empty")

Try / catch

try:
    out = await infer_action(client, payload, server_args)
except RuntimeError as e:
    if "no output" in str(e):
        return error_response(502, "policy produced no output")
    raise

Prevention

When it happens

Trigger: Calling create_action_generation or run_action_msgpack_ws when the scheduler returns a successful response whose output field is None — e.g. empty batch, request filtered out server-side, or a policy that emitted no tokens/actions.

Common situations: Sending an empty batch of observations, degenerate sampling settings (e.g. max_new_tokens=0) that yield no output, scheduler edge cases where a request is acked but produces nothing.

Related errors


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