{"record":{"id":"c241805a374958e1","repo":"sgl-project/sglang","slug":"unsupported-disaggregationmode-disaggregation-mo","errorCode":null,"errorMessage":"Unsupported DisaggregationMode: {disaggregation_mode}","messagePattern":"Unsupported DisaggregationMode: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"python/sglang/srt/disaggregation/ascend/transfer_engine.py","lineNumber":50,"sourceCode":"        if import_error is not None:\n            logger.warning(\n                \"Please install memfabric_hybrid, for details, see docs/docs/advanced_features/pd_disaggregation.mdx\"\n            )\n            raise import_error\n\n        self.engine = TransferEngine()\n        self.hostname = hostname\n        self.npu_id = npu_id\n\n        # Centralized storage address of the AscendTransferEngine\n        self.store_url = os.getenv(\"ASCEND_MF_STORE_URL\")\n        if disaggregation_mode == DisaggregationMode.PREFILL:\n            self.role = \"Prefill\"\n        elif disaggregation_mode == DisaggregationMode.DECODE:\n            self.role = \"Decode\"\n        else:\n            logger.error(f\"Unsupported DisaggregationMode: {disaggregation_mode}\")\n            raise ValueError(f\"Unsupported DisaggregationMode: {disaggregation_mode}\")\n        rpc_port = self.engine.get_rpc_port()\n        self.session_id = NetworkAddress(self.hostname, rpc_port).to_host_port_str()\n        self.initialize()\n        if rpc_port == 0:\n            rpc_port = self.engine.get_rpc_port()\n            self.session_id = NetworkAddress(self.hostname, rpc_port).to_host_port_str()\n\n    def initialize(self) -> None:\n        from sglang.srt.distributed.parallel_state import (\n            get_world_group,\n            get_world_size,\n        )\n\n        transfer_protocol = self._get_transfer_protocol()\n        if transfer_protocol is None or transfer_protocol == \"sdma\":\n            trans_op_type = TransferEngine.TransDataOpType.SDMA\n        else:\n            trans_op_type = TransferEngine.TransDataOpType.DEVICE_RDMA","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/disaggregation/ascend/transfer_engine.py#L32-L68","documentation":"The Ascend transfer engine wrapper only accepts PREFILL or DECODE roles from DisaggregationMode during construction; any other value (e.g. NONE or None) logs and raises ValueError. The role string feeds the underlying engine.initialize call, so an invalid mode must fail fast.","triggerScenarios":"Constructing AscendTransferEngine with disaggregation_mode=DisaggregationMode.NONE (the default when disaggregation is not enabled), or a None/invalid mode value.","commonSituations":"Server launched without --disaggregation-mode prefill|decode but the Ascend PD component still gets constructed; typos or missing config plumbing in custom launch scripts; component instantiated unconditionally in a code path that also runs in non-PD mode.","solutions":["Set --disaggregation-mode prefill on the prefill instance and decode on the decode instance","Only construct the Ascend transfer engine on nodes actually participating in PD disaggregation","Guard construction: skip when disaggregation_mode is NONE"],"exampleFix":"# before\nengine = AscendTransferEngine(...)  # mode defaults to NONE\n# after\nengine = (AscendTransferEngine(..., disaggregation_mode=DisaggregationMode.PREFILL)\n          if args.disaggregation_mode != DisaggregationMode.NONE else None)","handlingStrategy":"validation","validationCode":"from sglang.srt.disaggregation import DisaggregationMode\\nassert disaggregation_mode in (DisaggregationMode.PREFILL, DisaggregationMode.DECODE), 'set --disaggregation-mode'","typeGuard":"def is_pd_mode(m) -> bool:\\n    return m in (DisaggregationMode.PREFILL, DisaggregationMode.DECODE)","tryCatchPattern":null,"preventionTips":["Always pass --disaggregation-mode prefill|decode in PD deployments","Skip constructing the transfer engine when mode is NONE","Validate mode early in launcher scripts"],"tags":["ascend","disaggregation","config","init"],"backgroundTag":"invalid-configuration-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}