{"record":{"id":"7817450e537b75e7","repo":"sgl-project/sglang","slug":"unsupported-config-file-path-config-format-ex","errorCode":null,"errorMessage":"Unsupported config file {path} (config format: {ext})","messagePattern":"Unsupported config file (.+?) \\(config format: (.+?)\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/mem_cache/hiradix_cache.py","lineNumber":739,"sourceCode":"        if storage_backend_extra_config:\n            try:\n                if storage_backend_extra_config.startswith(\"@\"):\n                    # Read config from a json/toml/yaml file\n                    path = storage_backend_extra_config[1:]\n                    ext = os.path.splitext(path)[1].lower()\n                    with open(path, \"rb\" if ext == \".toml\" else \"r\") as f:\n                        if ext == \".json\":\n                            extra_config = json.load(f)\n                        elif ext == \".toml\":\n                            import tomllib\n\n                            extra_config = tomllib.load(f)\n                        elif ext in (\".yaml\", \".yml\"):\n                            import yaml\n\n                            extra_config = yaml.safe_load(f)\n                        else:\n                            raise ValueError(\n                                f\"Unsupported config file {path} (config format: {ext})\"\n                            )\n                else:\n                    # read config from JSON string\n                    extra_config = json.loads(storage_backend_extra_config)\n            except Exception as e:\n                logger.error(f\"Invalid backend extra config JSON: {e}\")\n                raise e\n\n        defaults = PrefetchTimeoutConfig()\n        prefetch_threshold = extra_config.pop(\"prefetch_threshold\", 256)  # tokens\n        prefetch_timeout_base = extra_config.pop(\n            \"prefetch_timeout_base\", defaults.base\n        )  # seconds\n        prefetch_timeout_per_ki_token = extra_config.pop(\n            \"prefetch_timeout_per_ki_token\", defaults.per_ki_token\n        )  # seconds per 1024 tokens\n        prefetch_timeout_max = extra_config.pop(","sourceCodeStart":721,"sourceCodeEnd":757,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/mem_cache/hiradix_cache.py#L721-L757","documentation":"_parse_storage_backend_extra_config accepts a storage backend extra config either as a JSON string or as a path to a file. When it looks like a path, it dispatches on the file extension: .toml via tomllib, .yaml/.yml via yaml.safe_load; any other extension (or no recognized extension) raises this ValueError listing the offending path and extension.","triggerScenarios":"Passing --storage-backend-extra-config / hi-cache storage_backend_extra_config as a path to a file whose suffix is not .toml/.yaml/.yml (e.g. .json, .conf, .ini, .txt, or a missing extension).","commonSituations":"Users naturally try to point at a .json config file (only JSON strings are supported inline, not JSON files); typos in the filename; a config file with a double extension like config.yaml.bak; new users assuming any config format works.","solutions":["Rename the config file to .yaml, .yml, or .toml (convert JSON contents to one of those formats if needed)","Or inline the config as a JSON string instead of a file path: pass the JSON text directly to storage_backend_extra_config","Verify the path string doesn't have stray suffixes (.bak, ~, .tmp) that change the detected extension"],"exampleFix":"# before: JSON file path is rejected\n--storage-backend-extra-config /etc/hicache/config.json\n\n# after: either rename to YAML\n--storage-backend-extra-config /etc/hicache/config.yaml\n# or pass JSON inline\n--storage-backend-extra-config '{\"prefetch_threshold\": 2}'","handlingStrategy":"validation","validationCode":"import os\next = os.path.splitext(extra_config_path)[1].lower()\nassert ext in (\".toml\", \".yaml\", \".yml\") or not os.path.exists(extra_config_path), (\n    f\"config file must be .toml/.yaml/.yml or an inline JSON string, got {ext}\")","typeGuard":"def is_supported_config_arg(s: str) -> bool:\n    if os.path.exists(s):\n        return os.path.splitext(s)[1].lower() in (\".toml\", \".yaml\", \".yml\")\n    try:\n        json.loads(s); return True\n    except Exception:\n        return False","tryCatchPattern":null,"preventionTips":["Standardize extra-config files on .yaml or .toml","Lint config paths in launch scripts: reject extensions other than .toml/.yaml/.yml"],"tags":["hicache","config","file-format","extension"],"backgroundTag":"unsupported-config-file-format","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}