{"record":{"id":"4f0b5f2255fd1211","repo":"sgl-project/sglang","slug":"cache-salt-is-not-supported-by-the-experimental-c","errorCode":null,"errorMessage":"cache_salt is not supported by the experimental C++ radix tree","messagePattern":"cache_salt is not supported by the experimental C\\+\\+ radix tree","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/mem_cache/radix_cache_cpp.py","lineNumber":42,"sourceCode":"from sglang.srt.mem_cache.radix_cache import RadixKey\nfrom sglang.srt.runtime_context import (\n    get_memory,\n)\n\nif TYPE_CHECKING:\n    from sglang.srt.managers.schedule_batch import Req\n    from sglang.srt.mem_cache.cache_init_params import CacheInitParams\n    from sglang.srt.server_args import ServerArgs\n\n\nlogger = logging.getLogger(__name__)\n\n\nclass RadixCacheCpp(BasePrefixCache):\n    @staticmethod\n    def _reject_cache_salt(cache_salt: Optional[str]) -> None:\n        if cache_salt is not None:\n            raise ValueError(\n                \"cache_salt is not supported by the experimental C++ radix tree\"\n            )\n\n    def __init__(\n        self,\n        params: CacheInitParams,\n        server_args: ServerArgs,\n        enable_write_cancel: bool = False,\n    ):\n        self.disable = params.disable\n        self.enable_write_cancel = enable_write_cancel\n\n        assert (\n            params.enable_kv_cache_events is False\n        ), \"HiRadixCache does not support kv cache events yet\"\n\n        # record the nodes with ongoing write through\n        self.ongoing_write_through: Set[IOHandle] = set()","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/mem_cache/radix_cache_cpp.py#L24-L60","documentation":"RadixCacheCpp (the experimental C++ radix tree) rejects cache_salt entirely — any non-None salt raises ValueError at match_prefix, cache_finished_req, and cache_unfinished_req. The C++ tree has no salt-namespacing support yet, so this is a deliberate capability gate rather than a bug.","triggerScenarios":"Selecting the C++ backend (e.g. --radix-cache-backend with the cpp/'Flash' backend) while requests carry a cache_salt (from multi-tenant salting or --cache-salt style config), then any prefix op on the tree.","commonSituations":"Enabling the experimental C++ radix tree for speed on a deployment that already uses cache_salt; setting a global salt via server args and forgetting the C++ tree does not implement it.","solutions":["Remove/disable cache_salt for this deployment, or","Switch back to the default Python radix cache backend which supports cache_salt","Wait for / implement cache_salt support in the C++ tree before enabling it"],"exampleFix":"# before\nserver_args.radix_cache_backend = \"cpp\"\n# requests carry cache_salt='tenant-a'\n# after\nserver_args.radix_cache_backend = None  # default python RadixCache supports salt","handlingStrategy":"validation","validationCode":"if using_cpp_tree and requests_have_cache_salt:\n    raise ValueError(\"cache_salt unsupported by C++ radix tree; drop salt or switch backend\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check feature matrix before combining experimental backends with salting","Fail fast at startup by probing a match_prefix with the salt"],"tags":["radix-cache","cpp-backend","cache-salt","unsupported-feature","value-error"],"backgroundTag":"unsupported-feature-combination","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}