sgl-project/sglang · warning
Environment variable {key} is deprecated, please use {new_ke
Error message
Environment variable {key} is deprecated, please use {new_key} What it means
At startup sglang rewrites legacy SGL_-prefixed variables to SGLANG_. Any SGL_ name not covered by the explicit deprecation table triggers this generic warning and gets copied to the SGLANG_ equivalent.
Source
Thrown at python/sglang/srt/environ.py:1716
note="DFlash now auto-enables the min-free-slots delay; unset this env. "
"To override the threshold, use '--min-free-slots-delay'."
),
"SGLANG_ENABLE_UNIFIED_RADIX_TREE": _DeprecatedEnv(
note="The unified radix tree is the default tree cache now; unset this "
"env. The field is still defined for legacy call sites."
),
}
def _handle_deprecated_envs():
for old_name, deprecation in _DEPRECATED_ENVS.items():
deprecation.apply(old_name)
# Rewrite the legacy SGL_ prefix to SGLANG_ (names not covered above).
for key, value in list(os.environ.items()):
if key.startswith("SGL_") and key not in _DEPRECATED_ENVS:
new_key = key.replace("SGL_", "SGLANG_", 1)
warnings.warn(
f"Environment variable {key} is deprecated, please use {new_key}"
)
os.environ[new_key] = value
def third_party_cache_defaults() -> Dict[str, str]:
base = os.path.expanduser(envs.SGLANG_CACHE_DIR.get())
return {
"TRITON_CACHE_DIR": os.path.join(base, "triton"),
"TORCHINDUCTOR_CACHE_DIR": os.path.join(base, "inductor"),
"CUDA_CACHE_PATH": os.path.join(base, "nv"),
# FlashInfer appends ".cache/flashinfer" to this base itself, so this
# is the base dir rather than the final cache dir.
"FLASHINFER_WORKSPACE_BASE": base,
}
def redirect_third_party_caches():View on GitHub (pinned to 0132848349)
Solutions
- Search your environment/scripts for SGL_-prefixed names and rename them to SGLANG_
- Verify the renamed SGLANG_ var is actually a recognized setting (check sglang.srt.environ)
- Delete stale SGL_ vars that no longer correspond to any setting
Example fix
# before export SGL_RADIX_CACHE_AGE=3600 # after export SGLANG_RADIX_CACHE_AGE=3600
Defensive patterns
Strategy: validation
Validate before calling
legacy = [k for k in os.environ if k.startswith("SGL_")]
for k in legacy:
os.environ["SGLANG_" + k[4:]] = os.environ.pop(k) Prevention
- Namespace-check env stanzas in CI
- Avoid defining unrelated vars starting with SGL_
When it happens
Trigger: Having any environment variable starting with SGL_ that is not in _DEPRECATED_ENVS when the sglang runtime initializes.
Common situations: Old launch scripts exporting SGL_* flags; base images from earlier releases; accidentally defining an unrelated variable whose name happens to start with SGL_.
Related errors
- Environment variable '{self.deprecated_name}' is deprecated;
- Environment variable {old_name} is deprecated. Please use {s
- '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/12bf4c106de3d95e.
Report an issue: GitHub.