{"record":{"id":"da7ae6bb4607128f","repo":"sgl-project/sglang","slug":"invalid-ltx2-two-stage-device-mode-mode-r-expec-da7ae6","errorCode":null,"errorMessage":"Invalid ltx2_two_stage_device_mode={mode!r}. Expected one of {LTX2_TWO_STAGE_DEVICE_MODE_CHOICES}.","messagePattern":"Invalid ltx2_two_stage_device_mode=(.+?)\\. Expected one of (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/server_args/server_args.py","lineNumber":848,"sourceCode":"\n    def _adjust_ltx2_two_stage_device_mode(self):\n        if not self._is_ltx23_two_stage_pipeline():\n            return\n\n        mode = self.ltx2_two_stage_device_mode\n        env_mode = None\n        if mode is None:\n            env_mode = os.getenv(\"SGLANG_LTX2_TWO_STAGE_DEVICE_MODE\")\n            mode = (\n                _normalize_ltx2_two_stage_device_mode(env_mode)\n                if env_mode\n                else self._resolve_default_ltx2_two_stage_device_mode()\n            )\n        else:\n            mode = _normalize_ltx2_two_stage_device_mode(mode)\n\n        if mode not in LTX2_TWO_STAGE_DEVICE_MODES:\n            raise ValueError(\n                f\"Invalid ltx2_two_stage_device_mode={mode!r}. \"\n                f\"Expected one of {LTX2_TWO_STAGE_DEVICE_MODE_CHOICES}.\"\n            )\n\n        explicit_nonresident_dits = {\n            component_name: residency_mode\n            for component_name in (\"transformer\", \"transformer_2\")\n            if (residency_mode := self.explicit_residency_mode(component_name))\n            in (COMPONENT_OFFLOAD, LAYERWISE_OFFLOAD)\n        }\n        if mode == \"resident\" and explicit_nonresident_dits:\n            configured = \", \".join(\n                f\"{name}={residency_mode}\"\n                for name, residency_mode in explicit_nonresident_dits.items()\n            )\n            if self.is_arg_explicitly_set(\"ltx2_two_stage_device_mode\") or env_mode:\n                raise ValueError(\n                    \"ltx2_two_stage_device_mode=resident conflicts with explicit \"","sourceCodeStart":830,"sourceCodeEnd":866,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/server_args/server_args.py#L830-L866","documentation":"_adjust_ltx2_two_stage_device_mode normalizes ltx2_two_stage_device_mode and rejects any value outside LTX2_TWO_STAGE_DEVICE_MODES. The error prints the allowed choices tuple.","triggerScenarios":"Passing an unrecognized mode string such as 'gpu-gpu' or a typo like 'offloaded'; env-var or programmatic override with a value not in LTX2_TWO_STAGE_DEVICE_MODES.","commonSituations":"New/renamed modes after upgrading; hand-written YAML with invented mode names; case errors are handled by the normalizer, so failures are genuine value typos.","solutions":["Use one of the values listed in LTX2_TWO_STAGE_DEVICE_MODE_CHOICES (check the constant near the top of server_args.py)","Omit the option to get the auto-resolved default via _resolve_default_ltx2_two_stage_device_mode"],"exampleFix":"# before\nServerArgs(..., ltx2_two_stage_device_mode=\"cpu-offload\")\n# after\nServerArgs(..., ltx2_two_stage_device_mode=\"original\")","handlingStrategy":"validation","validationCode":"from sglang...server_args import LTX2_TWO_STAGE_DEVICE_MODES\nif mode not in LTX2_TWO_STAGE_DEVICE_MODES:\n    raise SystemExit(f'bad ltx2_two_stage_device_mode {mode!r}; use {LTX2_TWO_STAGE_DEVICE_MODES}')","typeGuard":"def is_valid_ltx2_mode(m) -> bool:\n    return m in LTX2_TWO_STAGE_DEVICE_MODES","tryCatchPattern":null,"preventionTips":["Pin the allowed choices from the installed version's constants, not docs","Prefer omitting the option to use the auto default"],"tags":["ltx2","device-placement","config-validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}