sgl-project/sglang · error · ValueError

raw_action_dim is required when only domain_id is provided

Error message

raw_action_dim is required when only domain_id is provided

What it means

When a Cosmos3 action request specifies only domain_id (no domain_name), the server cannot look up the action dimension, so raw_action_dim must be provided explicitly. This validation ensures the action output shape is well-defined for custom/numeric domain ids.

Source

Thrown at python/sglang/multimodal_gen/runtime/entrypoints/action/cosmos3.py:194

        raise ValueError("Cosmos3 inverse_dynamics input requires an observation video")
    if images and video_path is not None:
        raise ValueError("Cosmos3 action requests accept either an image or a video")
    batch_size = len(images) if images else 1
    max_batch_size = max(1, int(getattr(server_args, "batching_max_size", 1)))
    if batch_size > max_batch_size:
        raise ValueError(
            f"Cosmos3 action batch size {batch_size} exceeds "
            f"--batching-max-size={max_batch_size}"
        )
    image_path = None if not images else images[0] if batch_size == 1 else images

    domain_id = options.get("domain_id")
    domain_name = options.get("domain_name")
    raw_action_dim = options.get("raw_action_dim")
    if domain_id is None and not domain_name:
        raise ValueError("Cosmos3 action requests require domain_name or domain_id")
    if domain_id is not None and not domain_name and raw_action_dim is None:
        raise ValueError("raw_action_dim is required when only domain_id is provided")

    prompt = observation.get("prompt")
    if prompt is None:
        prompt = observation.get("task", "")
    if action_mode != "policy" and not isinstance(prompt, str):
        raise ValueError("Cosmos3 inverse_dynamics prompt must be a string")
    prompt = _action_prompt(prompt, batch_size)
    sampling_kwargs = {
        "request_id": payload.get("request_id") or payload.get("id"),
        "prompt": prompt,
        "image_path": image_path,
        "video_path": video_path,
        "action_mode": action_mode,
        "domain_id": domain_id,
        "domain_name": domain_name,
        "raw_action_dim": raw_action_dim,
        "action_fps": options.get("action_fps"),
        "action_view_point": options.get("action_view_point", "ego_view"),

View on GitHub (pinned to 0132848349)

Solutions

  1. Add raw_action_dim matching your robot's action space (e.g. 7 for a Franka arm) to the request
  2. Or use domain_name of a registered domain instead of domain_id

Example fix

# before
{"parameters": {"domain_id": 3}}
# after
{"parameters": {"domain_id": 3, "raw_action_dim": 7}}
Defensive patterns

Strategy: validation

Validate before calling

if params.get('domain_id') and not params.get('domain_name'):
    assert params.get('raw_action_dim') is not None, 'raw_action_dim required with domain_id only'

Prevention

When it happens

Trigger: POST /v1/actions with domain_id set, domain_name absent, and no raw_action_dim in parameters/observation.

Common situations: Migrating from domain_name to numeric ids incrementally; building custom domain configs where the id isn't registered server-side.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


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