{"record":{"id":"a7ddac3534d53081","repo":"sgl-project/sglang","slug":"no-raw-action-dim-for-cosmos3-embodiment-embodime","errorCode":null,"errorMessage":"No raw action dim for Cosmos3 embodiment {embodiment!r}. Expected one of {sorted(EMBODIMENT_TO_RAW_ACTION_DIM)}.","messagePattern":"No raw action dim for Cosmos3 embodiment (.+?)\\. Expected one of (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/cosmos3_action.py","lineNumber":104,"sourceCode":"        \"16,9\": (1280, 720),\n        \"9,16\": (720, 1280),\n    },\n}\n\nVIEWPOINT_TEMPLATES: dict[str, str] = {\n    \"ego_view\": \"This video is captured from a first-person perspective looking at the scene.\",\n    \"third_person_view\": \"This video is captured from a third-person perspective looking towards the agent from the front.\",\n    \"wrist_view\": \"This video is captured from a wrist-mounted camera.\",\n    \"concat_view\": \"This video contains concatenated views from multiple camera perspectives.\",\n}\n\n_STAT_KEYS = {\"mean\", \"std\", \"min\", \"max\", \"q01\", \"q99\"}\n\n\ndef get_raw_action_dim(embodiment: str) -> int:\n    key = embodiment.lower().strip()\n    if key not in EMBODIMENT_TO_RAW_ACTION_DIM:\n        raise ValueError(\n            f\"No raw action dim for Cosmos3 embodiment {embodiment!r}. Expected one \"\n            f\"of {sorted(EMBODIMENT_TO_RAW_ACTION_DIM)}.\"\n        )\n    return EMBODIMENT_TO_RAW_ACTION_DIM[key]\n\n\ndef canonical_aspect_ratio(width: int, height: int) -> str:\n    \"\"\"Canonical ``\"W,H\"`` aspect string for the action caption.\"\"\"\n    for sizes in VIDEO_RES_SIZE_INFO.values():\n        for aspect, (cand_w, cand_h) in sizes.items():\n            if width == cand_w and height == cand_h:\n                return aspect\n    divisor = math.gcd(width, height)\n    if divisor == 0:\n        raise ValueError(\n            f\"width and height must be non-zero, got width={width}, height={height}.\"\n        )\n    return f\"{width // divisor},{height // divisor}\"","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/cosmos3_action.py#L86-L122","documentation":"get_raw_action_dim maps an embodiment name (robot) to its raw action dimension via the EMBODIMENT_TO_RAW_ACTION_DIM table. Unknown or misspelled embodiment strings raise a ValueError listing all supported keys (compared after lower().strip()).","triggerScenarios":"Calling a Cosmos3 action request with embodiment='FrankaPanda ' or any string not in EMBODIMENT_TO_RAW_ACTION_DIM; the stage calls get_raw_action_dim during _prepare_action_latents.","commonSituations":"Typos or casing/whitespace variants that survive lower().strip() (e.g. 'franka_panda' vs 'franka-panda'); adding a new robot without registering its dimension in the table; API users guessing embodiment names.","solutions":["Use an embodiment string exactly matching a key in EMBODIMENT_TO_RAW_ACTION_DIM (inspect the table or the error's sorted list)","If a new robot, add its entry to EMBODIMENT_TO_RAW_ACTION_DIM in cosmos3_action.py and pass --raw-action-dim explicitly to bypass lookup","Validate/normalize embodiment names at the request boundary"],"exampleFix":"# before\nembodiment = \"Franka Panda\"\n# after\nfrom sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.cosmos3_action import EMBODIMENT_TO_RAW_ACTION_DIM\nembodiment = next(iter(EMBODIMENT_TO_RAW_ACTION_DIM))  # a valid key, e.g. 'franka-panda'","handlingStrategy":"type-guard","validationCode":"from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.cosmos3_action import EMBODIMENT_TO_RAW_ACTION_DIM\nembodiment = embodiment.lower().strip()\nassert embodiment in EMBODIMENT_TO_RAW_ACTION_DIM, f\"unknown embodiment; valid: {sorted(EMBODIMENT_TO_RAW_ACTION_DIM)}\"","typeGuard":"def is_known_embodiment(name: str) -> bool:\n    from ...cosmos3_action import EMBODIMENT_TO_RAW_ACTION_DIM\n    return name.lower().strip() in EMBODIMENT_TO_RAW_ACTION_DIM","tryCatchPattern":"try:\n    dim = get_raw_action_dim(embodiment)\nexcept ValueError:\n    dim = fallback_dim  # e.g. from --raw-action-dim","preventionTips":["Expose the embodiment list in your client's UI/docs","Normalize embodiment strings to canonical keys at ingestion","Pin the table in tests so renames surface immediately"],"tags":["cosmos3","embodiment","lookup","validation"],"backgroundTag":"unknown-lookup-key","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}