{"record":{"id":"d8efb889713aa57d","repo":"sgl-project/sglang","slug":"raw-action-dim-is-required-when-only-domain-id-is","errorCode":null,"errorMessage":"raw_action_dim is required when only domain_id is provided","messagePattern":"raw_action_dim is required when only domain_id is provided","errorType":"validation","errorClass":"ValueError","httpStatus":400,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/entrypoints/action/cosmos3.py","lineNumber":194,"sourceCode":"        raise ValueError(\"Cosmos3 inverse_dynamics input requires an observation video\")\n    if images and video_path is not None:\n        raise ValueError(\"Cosmos3 action requests accept either an image or a video\")\n    batch_size = len(images) if images else 1\n    max_batch_size = max(1, int(getattr(server_args, \"batching_max_size\", 1)))\n    if batch_size > max_batch_size:\n        raise ValueError(\n            f\"Cosmos3 action batch size {batch_size} exceeds \"\n            f\"--batching-max-size={max_batch_size}\"\n        )\n    image_path = None if not images else images[0] if batch_size == 1 else images\n\n    domain_id = options.get(\"domain_id\")\n    domain_name = options.get(\"domain_name\")\n    raw_action_dim = options.get(\"raw_action_dim\")\n    if domain_id is None and not domain_name:\n        raise ValueError(\"Cosmos3 action requests require domain_name or domain_id\")\n    if domain_id is not None and not domain_name and raw_action_dim is None:\n        raise ValueError(\"raw_action_dim is required when only domain_id is provided\")\n\n    prompt = observation.get(\"prompt\")\n    if prompt is None:\n        prompt = observation.get(\"task\", \"\")\n    if action_mode != \"policy\" and not isinstance(prompt, str):\n        raise ValueError(\"Cosmos3 inverse_dynamics prompt must be a string\")\n    prompt = _action_prompt(prompt, batch_size)\n    sampling_kwargs = {\n        \"request_id\": payload.get(\"request_id\") or payload.get(\"id\"),\n        \"prompt\": prompt,\n        \"image_path\": image_path,\n        \"video_path\": video_path,\n        \"action_mode\": action_mode,\n        \"domain_id\": domain_id,\n        \"domain_name\": domain_name,\n        \"raw_action_dim\": raw_action_dim,\n        \"action_fps\": options.get(\"action_fps\"),\n        \"action_view_point\": options.get(\"action_view_point\", \"ego_view\"),","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/entrypoints/action/cosmos3.py#L176-L212","documentation":"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.","triggerScenarios":"POST /v1/actions with domain_id set, domain_name absent, and no raw_action_dim in parameters/observation.","commonSituations":"Migrating from domain_name to numeric ids incrementally; building custom domain configs where the id isn't registered server-side.","solutions":["Add raw_action_dim matching your robot's action space (e.g. 7 for a Franka arm) to the request","Or use domain_name of a registered domain instead of domain_id"],"exampleFix":"# before\n{\"parameters\": {\"domain_id\": 3}}\n# after\n{\"parameters\": {\"domain_id\": 3, \"raw_action_dim\": 7}}","handlingStrategy":"validation","validationCode":"if params.get('domain_id') and not params.get('domain_name'):\n    assert params.get('raw_action_dim') is not None, 'raw_action_dim required with domain_id only'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer domain_name for known robots","Store raw_action_dim alongside custom domain ids in config"],"tags":["cosmos3","domain-config","action-dim","missing-required-field"],"backgroundTag":"missing-required-parameter","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}