{"record":{"id":"dde5acd6c620ff4e","repo":"sgl-project/sglang","slug":"invalid-hicache-storage-backend-extra-config-json","errorCode":null,"errorMessage":"Invalid hicache storage backend extra config JSON: {e}","messagePattern":"Invalid hicache storage backend extra config JSON: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/disaggregation/decode_kvcache_offload_manager.py","lineNumber":78,"sourceCode":"        if not isinstance(kv_cache, (MHATokenToKVPool, MLATokenToKVPool)):\n            raise ValueError(\"Unsupported KV cache type for decode offload\")\n        self.decode_host_mem_pool = build_kv_host_pool(\n            kv_pool=kv_cache,\n            page_size=self.page_size,\n            use_mla=isinstance(kv_cache, MLATokenToKVPool),\n        )\n\n        self.tp_group = tp_group\n        self.tp_world_size = torch.distributed.get_world_size(group=self.tp_group)\n\n        hicache_storage_backend_extra_config = {}\n        if get_memory().hicache_storage_backend_extra_config:\n            try:\n                hicache_storage_backend_extra_config = json.loads(\n                    get_memory().hicache_storage_backend_extra_config\n                )\n            except json.JSONDecodeError as e:\n                raise ValueError(\n                    f\"Invalid hicache storage backend extra config JSON: {e}\"\n                )\n\n        self.cache_controller = HiCacheController(\n            token_to_kv_pool_allocator=self.token_to_kv_pool_allocator,\n            mem_pool_host=self.decode_host_mem_pool,\n            page_size=self.page_size,\n            tp_group=tp_group,\n            io_backend=get_memory().hicache_io_backend,\n            load_cache_event=threading.Event(),\n            storage_backend=get_memory().hicache_storage_backend,\n            model_name=get_serving().served_model_name,\n            storage_backend_extra_config=hicache_storage_backend_extra_config,\n        )\n\n        self.ongoing_offload = {}\n        self.ongoing_backup = {}\n        self.offloaded_state = {}","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/disaggregation/decode_kvcache_offload_manager.py#L60-L96","documentation":"When a hicache_storage_backend_extra_config string is set (memory config), the decode offload manager parses it with json.loads and re-raises JSONDecodeError as ValueError. The extra config must be a valid JSON object string (it is passed to the storage backend, e.g. Mooncake/IoUring options).","triggerScenarios":"Passing --hicache-storage-backend-extra-config with malformed JSON — trailing commas, single quotes, unquoted keys, or a plain k=v string instead of JSON.","commonSituations":"Hand-writing the flag on the command line with shell quoting issues; pasting a Python-dict-style string instead of JSON; truncation by a config templating system.","solutions":["Validate the string with any JSON linter, then pass it as a compact JSON object: --hicache-storage-backend-extra-config '{\"k\":\"v\"}'","Use double quotes inside and single-quote (or proper escaping) the whole argument in shell","Remove the flag if you don't need backend-specific extra config"],"exampleFix":"# before\n--hicache-storage-backend-extra-config \"{'k': 'v',}\"  # invalid JSON\n# after\n--hicache-storage-backend-extra-config '{\"k\": \"v\"}'","handlingStrategy":"validation","validationCode":"import json\njson.loads(hicache_storage_backend_extra_config_str)  # raises before server start if invalid","typeGuard":"def is_valid_extra_config(s: str) -> bool:\n    try:\n        json.loads(s); return True\n    except json.JSONDecodeError:\n        return False","tryCatchPattern":"try:\n    cfg = json.loads(extra_config_str)\nexcept json.JSONDecodeError as e:\n    raise ValueError(f'Invalid hicache storage backend extra config JSON: {e}') from e","preventionTips":["Generate the flag from a dict via json.dumps instead of hand-writing JSON","Validate the string in your deploy pipeline before launch"],"tags":["hicache","json-config","decode-offload","config-parse-error"],"backgroundTag":"invalid-json-config","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}