sgl-project/sglang · error · ValueError
SGLANG_ENABLE_EPLB_BALANCEDNESS_METRIC is no longer supporte
Error message
SGLANG_ENABLE_EPLB_BALANCEDNESS_METRIC is no longer supported. Use --expert-balancedness-report-mode with one of: off, server_log, prometheus, both.
What it means
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.
Source
Thrown at python/sglang/srt/server_args.py:8105
)
def _validate_experimental_sgl_marlin(self):
view = self._resolved()
if view.moe_runner_backend != "experimental_sgl_marlin":
return
# ===== TO BE REFACTORED ====
from sglang.srt.lora.marlin_lora_temp.policy import (
validate_experimental_sgl_marlin_server_args,
)
validate_experimental_sgl_marlin_server_args(self, view)
# ===== END TO BE REFACTORED ====
def _handle_expert_distribution_metrics(self):
cfg = resolving_view(self)
if "SGLANG_ENABLE_EPLB_BALANCEDNESS_METRIC" in os.environ:
raise ValueError(
"SGLANG_ENABLE_EPLB_BALANCEDNESS_METRIC is no longer supported. Use "
"--expert-balancedness-report-mode with one of: off, server_log, "
"prometheus, both."
)
if self.should_report_expert_balancedness() and (
cfg.expert_distribution_recorder_mode is None
):
self._declare(
"_handle_expert_distribution_metrics",
expert_distribution_recorder_mode="stat",
)
if cfg.expert_distribution_recorder_buffer_size is None:
if (x := cfg.eplb_rebalance_num_iterations) is not None:
self._declare(
"_handle_expert_distribution_metrics",
expert_distribution_recorder_buffer_size=x,View on GitHub (pinned to 0132848349)
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
Example fix
# before export SGLANG_ENABLE_EPLB_BALANCEDNESS_METRIC=1 python -m sglang.launch_server ... # after python -m sglang.launch_server ... --expert-balancedness-report-mode both
Defensive patterns
Strategy: validation
Validate before calling
import os
os.environ.pop("SGLANG_ENABLE_EPLB_BALANCEDNESS_METRIC", None)
if want_balancedness:
cmd.append("--expert-balancedness-report-mode=both") Prevention
- Audit container/unit files for legacy SGLANG_* vars after upgrades
- Prefer CLI flags over env vars for tunables that have flag equivalents
When it happens
Trigger: Having SGLANG_ENABLE_EPLB_BALANCEDNESS_METRIC exported (to any value, including 0/empty) in the environment of the server process.
Common situations: Old deployment scripts, Docker images, or Helm charts that export the legacy env var; CI environments carrying stale variables after upgrading SGLang.
Related errors
- --ep-dispatch-algorithm {cfg.ep_dispatch_algorithm} picks a
- SGLANG_LOG_SCHEDULER_STATUS_TARGET is set but --enable-metri
- unknown q-prep variant {variant!r} (SGLANG_OPT_Q8KV8_QPREP_V
- MiniMax-H3 on MPS requires synchronous layerwise offload for
- MiniMax-H3 MPS execution does not support torch.compile; pas
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/49aa03a6fd747fd6.
Report an issue: GitHub.