sgl-project/sglang · warning · DeprecationWarning
Environment variable '{self.deprecated_name}' is deprecated;
Error message
Environment variable '{self.deprecated_name}' is deprecated; use '{self.name}' instead. The alias will be removed in a future release. What it means
A LegacyEnvVar alias (old SGL_-prefixed name or other legacy alias) was found in the environment while the canonical SGLANG_ name was unset. The value is honored via the alias, but a DeprecationWarning announces the alias will be removed.
Source
Thrown at python/sglang/srt/environ.py:172
class _DeprecatedEnvFallback:
"""Mixin for EnvField subclasses: if the canonical env var is not set,
check *deprecated_name* and emit DeprecationWarning before reading it.
Usage:
SGLANG_DSA_FUSE_TOPK = EnvBoolWithAlias(True, deprecated_name="SGLANG_NSA_FUSE_TOPK")
"""
def __init__(self, default: Any, deprecated_name: str, secret: bool = False):
super().__init__(default, secret=secret)
self.deprecated_name = deprecated_name
def get(self) -> Any:
if os.getenv(self.name) is None:
fallback = os.getenv(self.deprecated_name)
if fallback is not None:
warnings.warn(
f"Environment variable '{self.deprecated_name}' is deprecated; "
f"use '{self.name}' instead. "
"The alias will be removed in a future release.",
DeprecationWarning,
stacklevel=2,
)
os.environ[self.name] = fallback
return super().get()
class EnvBoolWithAlias(_DeprecatedEnvFallback, EnvBool):
pass
class EnvIntWithAlias(_DeprecatedEnvFallback, EnvInt):
pass
View on GitHub (pinned to 0132848349)
Solutions
- Rename the variable in your environment/Dockerfile/manifest to the canonical SGLANG_ name shown in the message
- Grep deployment configs for the deprecated alias and update all occurrences
- Unset the alias to confirm nothing silently depends on it
Example fix
# before export SGL_ENABLE_JIT_DEEPGEMM=1 # after export SGLANG_ENABLE_JIT_DEEPGEMM=1
Defensive patterns
Strategy: validation
Validate before calling
import re
for k in list(os.environ):
if k.startswith("SGL_"):
os.environ["SGLANG_" + k[4:]] = os.environ.pop(k) Prevention
- Standardize on SGLANG_ prefix in all env files
- Upgrade base images together with sglang releases
When it happens
Trigger: Exporting a deprecated alias name (e.g. SGL_CACHE_PATH style legacy key) without setting its canonical SGLANG_ replacement, then reading it via envs.<VAR>.get().
Common situations: Old Docker images or launch scripts carrying pre-rename env names; copy-pasted configs from before an sglang env-var rename.
Related errors
- Environment variable {old_name} is deprecated. Please use {s
- Environment variable {key} is deprecated, please use {new_ke
- 'python -m sglang.launch_server' is still supported, but 'sg
- 'data_parallel_rank' is deprecated, use 'routed_dp_rank' ins
- 'data_parallel_rank' is deprecated, use 'routed_dp_rank' ins
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/572886cfd0411856.
Report an issue: GitHub.