{"record":{"id":"e64e4e8b031b0d89","repo":"sgl-project/sglang","slug":"unsupported-action-mode-sp-action-mode-r-expect","errorCode":null,"errorMessage":"Unsupported action_mode={sp.action_mode!r}; expected one of {sorted(ACTION_MODES)}","messagePattern":"Unsupported action_mode=(.+?); expected one of (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/cosmos3.py","lineNumber":672,"sourceCode":"        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\n          clean conditioning (velocity mask 0) and the model predicts video.\n        - ``policy`` / ``inverse_dynamics``: actions are denoised from noise\n          (velocity mask 1); ``raw_action_dim`` is required.\n        \"\"\"\n        sp = batch.sampling_params\n        mode = str(sp.action_mode).strip().lower()\n        if mode not in ACTION_MODES:\n            raise ValueError(\n                f\"Unsupported action_mode={sp.action_mode!r}; \"\n                f\"expected one of {sorted(ACTION_MODES)}\"\n            )\n        action_dim = self.transformer.action_dim\n        num_frames = batch.num_frames\n\n        action_chunk_size = num_frames - 1 if num_frames > 1 else 1\n        action_offset = 1 if action_chunk_size == num_frames - 1 else 0\n\n        domain_id = self._resolve_domain_id(batch)\n        batch_dim = (\n            int(batch.raw_latent_shape[0])\n            if getattr(batch, \"raw_latent_shape\", None)\n            else 1\n        )\n        raw_action_dim = getattr(sp, \"raw_action_dim\", None)\n        if raw_action_dim is None:\n            embodiment = getattr(sp, \"domain_name\", None)","sourceCodeStart":654,"sourceCodeEnd":690,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/cosmos3.py#L654-L690","documentation":"_prepare_action_latents normalizes action_mode (strip+lower) and checks membership in the ACTION_MODES set, which contains 'policy', 'inverse_dynamics', and 'forward_dynamics'. Anything else, including typos or unnormalized variants that still fail, is rejected with the sorted valid list.","triggerScenarios":"Passing sampling_params.action_mode not in ACTION_MODES, e.g. 'Prediction', 'fd', or 'policy_v2'.","commonSituations":"Guessing mode names from another library, casing/typo issues, or stale names after an API rename.","solutions":["Use one of the exact modes from the error message (e.g. 'policy', 'forward_dynamics', 'inverse_dynamics')","Check for casing/whitespace; the code lowercases and strips, so only the name itself matters","If action generation isn't wanted, remove action_mode entirely"],"exampleFix":"# before\nsp.action_mode = 'ForwardDynamics'\n\n# after\nsp.action_mode = 'forward_dynamics'","handlingStrategy":"validation","validationCode":"from ... import ACTION_MODES\nassert str(sp.action_mode).strip().lower() in ACTION_MODES","typeGuard":"def is_valid_action_mode(mode: str, modes: set) -> bool:\n    return mode.strip().lower() in modes","tryCatchPattern":null,"preventionTips":["Use an Enum/Literal type for action_mode in your client code","Consult the error's sorted list when unsure of valid modes"],"tags":["cosmos3","action-generation","enum","invalid-argument-value"],"backgroundTag":"invalid-enum-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}