sgl-project/sglang · error · ValueError

Cosmos3 action requests require domain_name or domain_id

Error message

Cosmos3 action requests require domain_name or domain_id

What it means

Cosmos3 action requests need a robot domain specification: either domain_name (looked up to a known domain) or domain_id (with raw_action_dim). If both are missing the endpoint cannot size the action space and rejects the request. The values are read from the merged parameters/observation options.

Source

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

        raise ValueError("Cosmos3 policy input requires an observation image")
    if action_mode == "inverse_dynamics" and video_path is None:
        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,

View on GitHub (pinned to 0132848349)

Solutions

  1. Add domain_name for your robot (e.g. 'franka') to parameters
  2. Or supply domain_id plus raw_action_dim if using a custom domain

Example fix

# before
{"parameters": {"action_horizon": 16}}
# after
{"parameters": {"action_horizon": 16, "domain_name": "franka"}}
Defensive patterns

Strategy: validation

Validate before calling

assert params.get('domain_name') or params.get('domain_id'), 'domain_name or domain_id required'

Prevention

When it happens

Trigger: POST /v1/actions with neither domain_name nor domain_id in parameters or observation.

Common situations: Minimal test payload omitting domain config; assuming the server has a default domain; renamed field (e.g. 'domain') not recognized.

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/ba91eee4e2341da6. Report an issue: GitHub.