{"record":{"id":"572886cfd0411856","repo":"sgl-project/sglang","slug":"environment-variable-self-deprecated-name-is-d","errorCode":null,"errorMessage":"Environment variable '{self.deprecated_name}' is deprecated; use '{self.name}' instead. The alias will be removed in a future release.","messagePattern":"Environment variable '(.+?)' is deprecated; use '(.+?)' instead\\. The alias will be removed in a future release\\.","errorType":"console","errorClass":"DeprecationWarning","httpStatus":null,"severity":"warning","filePath":"python/sglang/srt/environ.py","lineNumber":172,"sourceCode":"\n\nclass _DeprecatedEnvFallback:\n    \"\"\"Mixin for EnvField subclasses: if the canonical env var is not set,\n    check *deprecated_name* and emit DeprecationWarning before reading it.\n\n    Usage:\n        SGLANG_DSA_FUSE_TOPK = EnvBoolWithAlias(True, deprecated_name=\"SGLANG_NSA_FUSE_TOPK\")\n    \"\"\"\n\n    def __init__(self, default: Any, deprecated_name: str, secret: bool = False):\n        super().__init__(default, secret=secret)\n        self.deprecated_name = deprecated_name\n\n    def get(self) -> Any:\n        if os.getenv(self.name) is None:\n            fallback = os.getenv(self.deprecated_name)\n            if fallback is not None:\n                warnings.warn(\n                    f\"Environment variable '{self.deprecated_name}' is deprecated; \"\n                    f\"use '{self.name}' instead. \"\n                    \"The alias will be removed in a future release.\",\n                    DeprecationWarning,\n                    stacklevel=2,\n                )\n                os.environ[self.name] = fallback\n        return super().get()\n\n\nclass EnvBoolWithAlias(_DeprecatedEnvFallback, EnvBool):\n    pass\n\n\nclass EnvIntWithAlias(_DeprecatedEnvFallback, EnvInt):\n    pass\n\n","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/environ.py#L154-L190","documentation":"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.","triggerScenarios":"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().","commonSituations":"Old Docker images or launch scripts carrying pre-rename env names; copy-pasted configs from before an sglang env-var rename.","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"],"exampleFix":"# before\nexport SGL_ENABLE_JIT_DEEPGEMM=1\n# after\nexport SGLANG_ENABLE_JIT_DEEPGEMM=1","handlingStrategy":"validation","validationCode":"import re\nfor k in list(os.environ):\n    if k.startswith(\"SGL_\"):\n        os.environ[\"SGLANG_\" + k[4:]] = os.environ.pop(k)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize on SGLANG_ prefix in all env files","Upgrade base images together with sglang releases"],"tags":["deprecation","environment-variables","alias","migration"],"backgroundTag":"deprecated-env-var","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}