{"record":{"id":"ad5e965f660d930b","repo":"sgl-project/sglang","slug":"sglang-srt-layers-attention-nsa-is-deprecated-use","errorCode":null,"errorMessage":"sglang.srt.layers.attention.nsa is deprecated; use sglang.srt.layers.attention.dsa instead.","messagePattern":"sglang\\.srt\\.layers\\.attention\\.nsa is deprecated; use sglang\\.srt\\.layers\\.attention\\.dsa instead\\.","errorType":"console","errorClass":"DeprecationWarning","httpStatus":null,"severity":"warning","filePath":"python/sglang/srt/layers/attention/nsa/__init__.py","lineNumber":5,"sourceCode":"# [Deprecated] attention/nsa/ is a thin re-export shim for backward compatibility.\n# Use attention/dsa/ instead. This directory will be removed in a future release.\nimport warnings\n\nwarnings.warn(\n    \"sglang.srt.layers.attention.nsa is deprecated; \"\n    \"use sglang.srt.layers.attention.dsa instead.\",\n    DeprecationWarning,\n    stacklevel=2,\n)\nfrom sglang.srt.layers.attention.dsa import *  # noqa: F401, F403\n","sourceCodeStart":1,"sourceCodeEnd":12,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/layers/attention/nsa/__init__.py#L1-L12","documentation":"Importing sglang.srt.layers.attention.nsa raises a DeprecationWarning at import time because the package is now a thin re-export shim over sglang.srt.layers.attention.dsa. All symbols still resolve via star-import, so code works, but the shim will be deleted.","triggerScenarios":"Any 'import sglang.srt.layers.attention.nsa' or 'from sglang.srt.layers.attention.nsa import ...' statement, including transitive imports from third-party patches or old code.","commonSituations":"Custom model files or monkey-patches importing from the old nsa path; upgrading sglang in a repo with vendored attention code.","solutions":["Rewrite imports to use sglang.srt.layers.attention.dsa","Grep the codebase for 'attention.nsa' and update all matches","Run with -W error::DeprecationWarning in CI to surface latent imports"],"exampleFix":"# before\nfrom sglang.srt.layers.attention.nsa import NativeSparseAttnBackend\n# after\nfrom sglang.srt.layers.attention.dsa import NativeSparseAttnBackend","handlingStrategy":"validation","validationCode":"import importlib, warnings\nwith warnings.catch_warnings():\n    warnings.simplefilter(\"error\", DeprecationWarning)\n    importlib.import_module(\"my_pkg\")  # surfaces legacy nsa imports","typeGuard":"def uses_deprecated_nsa(module_source: str) -> bool:\n    return \"attention.nsa\" in module_source","tryCatchPattern":null,"preventionTips":["Grep for attention.nsa after upgrades","Import-time DeprecationWarning-as-error in CI"],"tags":["deprecation","import","module-rename","nsa","dsa"],"backgroundTag":"deprecated-module-import","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}