{"record":{"id":"12bf4c106de3d95e","repo":"sgl-project/sglang","slug":"environment-variable-key-is-deprecated-please-u","errorCode":null,"errorMessage":"Environment variable {key} is deprecated, please use {new_key}","messagePattern":"Environment variable (.+?) is deprecated, please use (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"python/sglang/srt/environ.py","lineNumber":1716,"sourceCode":"        note=\"DFlash now auto-enables the min-free-slots delay; unset this env. \"\n        \"To override the threshold, use '--min-free-slots-delay'.\"\n    ),\n    \"SGLANG_ENABLE_UNIFIED_RADIX_TREE\": _DeprecatedEnv(\n        note=\"The unified radix tree is the default tree cache now; unset this \"\n        \"env. The field is still defined for legacy call sites.\"\n    ),\n}\n\n\ndef _handle_deprecated_envs():\n    for old_name, deprecation in _DEPRECATED_ENVS.items():\n        deprecation.apply(old_name)\n\n    # Rewrite the legacy SGL_ prefix to SGLANG_ (names not covered above).\n    for key, value in list(os.environ.items()):\n        if key.startswith(\"SGL_\") and key not in _DEPRECATED_ENVS:\n            new_key = key.replace(\"SGL_\", \"SGLANG_\", 1)\n            warnings.warn(\n                f\"Environment variable {key} is deprecated, please use {new_key}\"\n            )\n            os.environ[new_key] = value\n\n\ndef third_party_cache_defaults() -> Dict[str, str]:\n    base = os.path.expanduser(envs.SGLANG_CACHE_DIR.get())\n    return {\n        \"TRITON_CACHE_DIR\": os.path.join(base, \"triton\"),\n        \"TORCHINDUCTOR_CACHE_DIR\": os.path.join(base, \"inductor\"),\n        \"CUDA_CACHE_PATH\": os.path.join(base, \"nv\"),\n        # FlashInfer appends \".cache/flashinfer\" to this base itself, so this\n        # is the base dir rather than the final cache dir.\n        \"FLASHINFER_WORKSPACE_BASE\": base,\n    }\n\n\ndef redirect_third_party_caches():","sourceCodeStart":1698,"sourceCodeEnd":1734,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/environ.py#L1698-L1734","documentation":"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.","triggerScenarios":"Having any environment variable starting with SGL_ that is not in _DEPRECATED_ENVS when the sglang runtime initializes.","commonSituations":"Old launch scripts exporting SGL_* flags; base images from earlier releases; accidentally defining an unrelated variable whose name happens to start with SGL_.","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"],"exampleFix":"# before\nexport SGL_RADIX_CACHE_AGE=3600\n# after\nexport SGLANG_RADIX_CACHE_AGE=3600","handlingStrategy":"validation","validationCode":"legacy = [k for k in os.environ if k.startswith(\"SGL_\")]\nfor k in legacy:\n    os.environ[\"SGLANG_\" + k[4:]] = os.environ.pop(k)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Namespace-check env stanzas in CI","Avoid defining unrelated vars starting with SGL_"],"tags":["deprecation","environment-variables","prefix-rewrite","migration"],"backgroundTag":"deprecated-env-var","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}