sgl-project/sglang · error · ValueError
Unsupported config file {path} (config format: {ext})
Error message
Unsupported config file {path} (config format: {ext}) What it means
_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.
Source
Thrown at python/sglang/srt/mem_cache/hiradix_cache.py:739
if storage_backend_extra_config:
try:
if storage_backend_extra_config.startswith("@"):
# Read config from a json/toml/yaml file
path = storage_backend_extra_config[1:]
ext = os.path.splitext(path)[1].lower()
with open(path, "rb" if ext == ".toml" else "r") as f:
if ext == ".json":
extra_config = json.load(f)
elif ext == ".toml":
import tomllib
extra_config = tomllib.load(f)
elif ext in (".yaml", ".yml"):
import yaml
extra_config = yaml.safe_load(f)
else:
raise ValueError(
f"Unsupported config file {path} (config format: {ext})"
)
else:
# read config from JSON string
extra_config = json.loads(storage_backend_extra_config)
except Exception as e:
logger.error(f"Invalid backend extra config JSON: {e}")
raise e
defaults = PrefetchTimeoutConfig()
prefetch_threshold = extra_config.pop("prefetch_threshold", 256) # tokens
prefetch_timeout_base = extra_config.pop(
"prefetch_timeout_base", defaults.base
) # seconds
prefetch_timeout_per_ki_token = extra_config.pop(
"prefetch_timeout_per_ki_token", defaults.per_ki_token
) # seconds per 1024 tokens
prefetch_timeout_max = extra_config.pop(View on GitHub (pinned to 0132848349)
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
Example fix
# before: JSON file path is rejected
--storage-backend-extra-config /etc/hicache/config.json
# after: either rename to YAML
--storage-backend-extra-config /etc/hicache/config.yaml
# or pass JSON inline
--storage-backend-extra-config '{"prefetch_threshold": 2}' Defensive patterns
Strategy: validation
Validate before calling
import os
ext = os.path.splitext(extra_config_path)[1].lower()
assert ext in (".toml", ".yaml", ".yml") or not os.path.exists(extra_config_path), (
f"config file must be .toml/.yaml/.yml or an inline JSON string, got {ext}") Type guard
def is_supported_config_arg(s: str) -> bool:
if os.path.exists(s):
return os.path.splitext(s)[1].lower() in (".toml", ".yaml", ".yml")
try:
json.loads(s); return True
except Exception:
return False Prevention
- Standardize extra-config files on .yaml or .toml
- Lint config paths in launch scripts: reject extensions other than .toml/.yaml/.yml
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- This browser cannot encode H.264 MP4
- H.264 encoder did not return MP4 decoder config
- This browser does not support gzip stream decoding
- delta payload size mismatch: expected ${expectedSize}, got $
- /v1/models ${response.status}
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/7817450e537b75e7.
Report an issue: GitHub.