{"record":{"id":"a1a8b6700bf22cb6","repo":"sgl-project/sglang","slug":"cosmos3-action-generation-requires-domain-id-or","errorCode":null,"errorMessage":"Cosmos3 action generation requires --domain-id or --domain-name.","messagePattern":"Cosmos3 action generation requires --domain-id or --domain-name\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/cosmos3.py","lineNumber":646,"sourceCode":"    @staticmethod\n    def _resolve_domain_id(batch: Req) -> int:\n        \"\"\"Resolve action embodiment domain ID; required for action generation.\"\"\"\n        domain_id = getattr(batch.sampling_params, \"domain_id\", None)\n        if domain_id is not None:\n            domain_id = int(domain_id)\n            if domain_id < 0:\n                raise ValueError(f\"domain_id must be non-negative, got {domain_id}\")\n            return domain_id\n        domain_name = getattr(batch.sampling_params, \"domain_name\", None)\n        if domain_name:\n            key = str(domain_name).strip().lower()\n            if key not in EMBODIMENT_TO_DOMAIN_ID:\n                raise ValueError(\n                    f\"Unknown action domain name {domain_name!r}. \"\n                    f\"Valid names: {sorted(EMBODIMENT_TO_DOMAIN_ID)}\"\n                )\n            return EMBODIMENT_TO_DOMAIN_ID[key]\n        raise ValueError(\n            \"Cosmos3 action generation requires --domain-id or --domain-name.\"\n        )\n\n    def _prepare_action_latents(\n        self,\n        batch: Req,\n        generator,\n        device: torch.device,\n        dtype: torch.dtype,\n    ) -> None:\n        \"\"\"Prepare action latents and conditioning, writing them onto ``batch``.\n\n        Action tokens run at frame rate (no temporal compression), so the chunk\n        length is ``num_frames - 1`` with ``start_frame_offset=1`` so each action\n        aligns with the frame it drives.\n\n        Three modes:\n        - ``forward_dynamics``: the user supplies the action; all tokens are","sourceCodeStart":628,"sourceCodeEnd":664,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/cosmos3.py#L628-L664","documentation":"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.","triggerScenarios":"Enabling action_mode without setting either domain_id or domain_name on sampling params; both attributes missing/None/empty.","commonSituations":"Copy-pasting an action example while dropping the domain flags, or CLI users forgetting --domain-id/--domain-name as the message suggests.","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"],"exampleFix":"# before\nsp.action_mode = 'policy'\n\n# after\nsp.action_mode = 'policy'\nsp.domain_id = 0  # or sp.domain_name = 'franka_arm'","handlingStrategy":"validation","validationCode":"if sp.action_mode is not None:\n    assert sp.domain_id is not None or sp.domain_name, 'action generation requires a domain'","typeGuard":"def has_domain(sp) -> bool:\n    return sp.domain_id is not None or bool(getattr(sp, 'domain_name', None))","tryCatchPattern":null,"preventionTips":["Make domain_id/domain_name required fields in request schemas when action_mode is set","Add CLI arg validation before submission"],"tags":["cosmos3","action-generation","missing-parameter","domain-id"],"backgroundTag":"missing-required-parameter","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}