sgl-project/sglang · error · ValueError
Cosmos3 action generation requires --domain-id or --domain-n
Error message
Cosmos3 action generation requires --domain-id or --domain-name.
What it means
Action generation needs an embodiment domain to embed actions correctly. If neither sampling_params.domain_id nor domain_name is provided, _resolve_domain_id raises immediately when action_mode is active.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/cosmos3.py:646
@staticmethod
def _resolve_domain_id(batch: Req) -> int:
"""Resolve action embodiment domain ID; required for action generation."""
domain_id = getattr(batch.sampling_params, "domain_id", None)
if domain_id is not None:
domain_id = int(domain_id)
if domain_id < 0:
raise ValueError(f"domain_id must be non-negative, got {domain_id}")
return domain_id
domain_name = getattr(batch.sampling_params, "domain_name", None)
if domain_name:
key = str(domain_name).strip().lower()
if key not in EMBODIMENT_TO_DOMAIN_ID:
raise ValueError(
f"Unknown action domain name {domain_name!r}. "
f"Valid names: {sorted(EMBODIMENT_TO_DOMAIN_ID)}"
)
return EMBODIMENT_TO_DOMAIN_ID[key]
raise ValueError(
"Cosmos3 action generation requires --domain-id or --domain-name."
)
def _prepare_action_latents(
self,
batch: Req,
generator,
device: torch.device,
dtype: torch.dtype,
) -> None:
"""Prepare action latents and conditioning, writing them onto ``batch``.
Action tokens run at frame rate (no temporal compression), so the chunk
length is ``num_frames - 1`` with ``start_frame_offset=1`` so each action
aligns with the frame it drives.
Three modes:
- ``forward_dynamics``: the user supplies the action; all tokens areView on GitHub (pinned to 0132848349)
Solutions
- Set domain_id to a valid non-negative integer
- Or set domain_name to a valid embodiment name
- Make domain params required in your request builder when action_mode is used
Example fix
# before sp.action_mode = 'policy' # after sp.action_mode = 'policy' sp.domain_id = 0 # or sp.domain_name = 'franka_arm'
Defensive patterns
Strategy: validation
Validate before calling
if sp.action_mode is not None:
assert sp.domain_id is not None or sp.domain_name, 'action generation requires a domain' Type guard
def has_domain(sp) -> bool:
return sp.domain_id is not None or bool(getattr(sp, 'domain_name', None)) Prevention
- Make domain_id/domain_name required fields in request schemas when action_mode is set
- Add CLI arg validation before submission
When it happens
Trigger: Enabling action_mode without setting either domain_id or domain_name on sampling params; both attributes missing/None/empty.
Common situations: Copy-pasting an action example while dropping the domain flags, or CLI users forgetting --domain-id/--domain-name as the message suggests.
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
- domain_id must be non-negative, got {domain_id}
- action_mode='forward_dynamics' requires an 'action' array (l
- Cosmos3 action generation does not support sequence parallel
- action_mode is set but the loaded Cosmos3 checkpoint has no
- Unknown action domain name {domain_name!r}. Valid names: {so
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/a1a8b6700bf22cb6.
Report an issue: GitHub.