{"record":{"id":"49aa03a6fd747fd6","repo":"sgl-project/sglang","slug":"sglang-enable-eplb-balancedness-metric-is-no-longe","errorCode":null,"errorMessage":"SGLANG_ENABLE_EPLB_BALANCEDNESS_METRIC is no longer supported. Use --expert-balancedness-report-mode with one of: off, server_log, prometheus, both.","messagePattern":"SGLANG_ENABLE_EPLB_BALANCEDNESS_METRIC is no longer supported\\. Use --expert-balancedness-report-mode with one of: off, server_log, prometheus, both\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/server_args.py","lineNumber":8105,"sourceCode":"            )\n\n    def _validate_experimental_sgl_marlin(self):\n        view = self._resolved()\n        if view.moe_runner_backend != \"experimental_sgl_marlin\":\n            return\n\n        # ===== TO BE REFACTORED ====\n        from sglang.srt.lora.marlin_lora_temp.policy import (\n            validate_experimental_sgl_marlin_server_args,\n        )\n\n        validate_experimental_sgl_marlin_server_args(self, view)\n        # ===== END TO BE REFACTORED ====\n\n    def _handle_expert_distribution_metrics(self):\n        cfg = resolving_view(self)\n        if \"SGLANG_ENABLE_EPLB_BALANCEDNESS_METRIC\" in os.environ:\n            raise ValueError(\n                \"SGLANG_ENABLE_EPLB_BALANCEDNESS_METRIC is no longer supported. Use \"\n                \"--expert-balancedness-report-mode with one of: off, server_log, \"\n                \"prometheus, both.\"\n            )\n\n        if self.should_report_expert_balancedness() and (\n            cfg.expert_distribution_recorder_mode is None\n        ):\n            self._declare(\n                \"_handle_expert_distribution_metrics\",\n                expert_distribution_recorder_mode=\"stat\",\n            )\n\n        if cfg.expert_distribution_recorder_buffer_size is None:\n            if (x := cfg.eplb_rebalance_num_iterations) is not None:\n                self._declare(\n                    \"_handle_expert_distribution_metrics\",\n                    expert_distribution_recorder_buffer_size=x,","sourceCodeStart":8087,"sourceCodeEnd":8123,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/server_args.py#L8087-L8123","documentation":"Raised during expert-metrics resolution when the legacy environment variable SGLANG_ENABLE_EPLB_BALANCEDNESS_METRIC is set. The env-var toggle was replaced by the --expert-balancedness-report-mode flag (off | server_log | prometheus | both); the resolver hard-fails so users notice the migration instead of silently losing metrics.","triggerScenarios":"Having SGLANG_ENABLE_EPLB_BALANCEDNESS_METRIC exported (to any value, including 0/empty) in the environment of the server process.","commonSituations":"Old deployment scripts, Docker images, or Helm charts that export the legacy env var; CI environments carrying stale variables after upgrading SGLang.","solutions":["Unset the variable: unset SGLANG_ENABLE_EPLB_BALANCEDNESS_METRIC (or remove it from the container/unit spec)","Replace it with --expert-balancedness-report-mode server_log|prometheus|both as needed"],"exampleFix":"# before\nexport SGLANG_ENABLE_EPLB_BALANCEDNESS_METRIC=1\npython -m sglang.launch_server ...\n# after\npython -m sglang.launch_server ... --expert-balancedness-report-mode both","handlingStrategy":"validation","validationCode":"import os\nos.environ.pop(\"SGLANG_ENABLE_EPLB_BALANCEDNESS_METRIC\", None)\nif want_balancedness:\n    cmd.append(\"--expert-balancedness-report-mode=both\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Audit container/unit files for legacy SGLANG_* vars after upgrades","Prefer CLI flags over env vars for tunables that have flag equivalents"],"tags":["env-var","eplb","metrics","migration","server-args","deprecated"],"backgroundTag":"removed-env-var-migration","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}