{"record":{"id":"661575603fe2ebf6","repo":"sgl-project/sglang","slug":"enable-session-radix-cache-requires-unifiedradix","errorCode":null,"errorMessage":"--enable-session-radix-cache requires UnifiedRadixCache, but tree_cache is {type(cache).__name__}. Drop the flag or the option that selected another tree cache for this model.","messagePattern":"--enable-session-radix-cache requires UnifiedRadixCache, but tree_cache is (.+?)\\. Drop the flag or the option that selected another tree cache for this model\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/mem_cache/registry.py","lineNumber":231,"sourceCode":"        cache = default_radix_cache_factory(ctx)\n        source = \"default\"\n\n    if (\n        get_memory().enable_hierarchical_cache\n        and ctx.server_args.hicache_host_memory_mode == \"buffer_only\"\n    ):\n        from sglang.srt.mem_cache.unified_radix_cache import UnifiedRadixCache\n\n        if not isinstance(cache, UnifiedRadixCache):\n            raise ValueError(\n                \"--hicache-host-memory-mode buffer_only is only implemented for \"\n                f\"the unified radix tree; this model selected {type(cache).__name__}.\"\n            )\n\n    if ctx.server_args.enable_session_radix_cache and not getattr(\n        cache, \"enable_session_radix_cache\", False\n    ):\n        raise ValueError(\n            \"--enable-session-radix-cache requires UnifiedRadixCache, but \"\n            f\"tree_cache is {type(cache).__name__}. Drop the flag or the \"\n            \"option that selected another tree cache for this model.\"\n        )\n\n    hicache_attached = cache.cache_controller is not None\n    streaming_wrapped = False\n    if (\n        ctx.server_args.enable_streaming_session\n        and not cache.supports_streaming_session()\n    ):\n        from sglang.srt.session.streaming_session import StreamingSession\n\n        cache = StreamingSession(cache)\n        streaming_wrapped = True\n\n    logger.info(\n        \"Tree cache initialized: source=%s impl=%s hybrid_swa=%s hybrid_ssm=%s \"","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/mem_cache/registry.py#L213-L249","documentation":"create_tree_cache rejects --enable-session-radix-cache when the constructed tree cache lacks the enable_session_radix_cache attribute (i.e. is not UnifiedRadixCache). Session-scoped radix caching is implemented only on the unified cache, so other backends cannot honor the flag.","triggerScenarios":"Launching with --enable-session-radix-cache while another option (backend selection or model-specific factory) yields a non-unified cache class.","commonSituations":"Enabling per-session cache isolation for privacy in a deployment that also selects the C++ radix backend or a custom registered cache.","solutions":["Remove --enable-session-radix-cache, or remove the flag/setting that selected the non-unified tree cache","Use the default (unified) radix cache to keep session semantics","Extend a custom backend with an enable_session_radix_cache capability if you must keep it"],"exampleFix":"# before\n--enable-session-radix-cache --radix-cache-backend cpp\n# after\n--enable-session-radix-cache","handlingStrategy":"validation","validationCode":"if server_args.enable_session_radix_cache:\n    assert server_args.radix_cache_backend in (None, \"\"), \"session radix cache needs unified tree\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Don't mix session-cache flag with alternate tree backends"],"tags":["session-cache","unified-cache","server-args","value-error"],"backgroundTag":"unsupported-feature-combination","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}