{"record":{"id":"f999627ac8dfa7dc","repo":"sgl-project/sglang","slug":"invalid-ltx2-two-stage-device-mode-mode-r-expec","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/pipelines/ltx_2_pipeline.py","lineNumber":577,"sourceCode":"        self.server_args = server_args\n        self.mode = self._resolve_mode(server_args)\n        self._active_phase: str | None = None\n        self._strategy = self._build_strategy()\n\n    @classmethod\n    def _resolve_mode(cls, server_args: ServerArgs) -> str:\n        mode = server_args.ltx2_two_stage_device_mode\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 \"original\"\n            )\n        else:\n            mode = _normalize_ltx2_two_stage_device_mode(mode)\n        if mode not in cls.VALID_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        return mode\n\n    def _build_strategy(self) -> LTX2TwoStageResidencyStrategy:\n        if self.mode == \"resident\":\n            return LTX2ResidentResidencyStrategy(self)\n        return LTX2OriginalResidencyStrategy(self)\n\n    @property\n    def strategy(self) -> ComponentResidencyStrategy:\n        return self._strategy\n\n    @property\n    def should_use_premerged(self) -> bool:\n        \"\"\"Whether to keep a pre-merged stage-2 DiT for LTX-2.3 two-stage.\n","sourceCodeStart":559,"sourceCodeEnd":595,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines/ltx_2_pipeline.py#L559-L595","documentation":"Raised by LTX2TwoStageDeviceMode._resolve_mode when the requested two-stage device placement mode is not in VALID_MODES. Mode strings come from the argument or the LTX2_TWO_STAGE_DEVICE_MODE environment variable and are normalized before validation, so this fires only for genuinely unknown values.","triggerScenarios":"Passing an invalid mode string (typo like 'orginal', unsupported value like 'cpu') to the two-stage device-mode resolver; exporting LTX2_TWO_STAGE_DEVICE_MODE with a misspelled value that gets picked up at startup.","commonSituations":"Typos in env vars or config files; modes renamed/removed across sglang versions so old configs now fail; copying a mode name from outdated docs.","solutions":["Set the mode to one of LTX2_TWO_STAGE_DEVICE_MODE_CHOICES (e.g. 'original' or the documented alternates) — print that constant to see valid values for your version","Unset LTX2_TWO_STAGE_DEVICE_MODE if you want the default 'original' behavior","After upgrading sglang, re-check the choices constant for renamed modes"],"exampleFix":"# before\nexport LTX2_TWO_STAGE_DEVICE_MODE=orginal  # typo\n\n# after\nexport LTX2_TWO_STAGE_DEVICE_MODE=original","handlingStrategy":"validation","validationCode":"from sglang.multimodal_gen.runtime.pipelines.ltx_2_pipeline import LTX2_TWO_STAGE_DEVICE_MODE_CHOICES\nmode = os.environ.get('LTX2_TWO_STAGE_DEVICE_MODE', 'original')\nassert mode in LTX2_TWO_STAGE_DEVICE_MODE_CHOICES, f'bad mode {mode!r}'","typeGuard":"def is_valid_ltx2_mode(mode: str) -> bool:\n    return mode in LTX2_TWO_STAGE_DEVICE_MODE_CHOICES","tryCatchPattern":null,"preventionTips":["Validate env-derived config values at process start","Re-check the CHOICES constant after sglang upgrades"],"tags":["ltx2","device-mode","env-var","invalid-value","sglang"],"backgroundTag":"invalid-config-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}