sgl-project/sglang · error · RuntimeError
Failed to load config from {file_path}: {str(e)}
Error message
Failed to load config from {file_path}: {str(e)} What it means
The JSON file pointed to by SGLANG_HICACHE_MOONCAKE_CONFIG_PATH could not be opened or parsed (json.load raised). The message includes the path and the underlying exception text (FileNotFoundError, PermissionError, or JSONDecodeError).
Source
Thrown at python/sglang/srt/mem_cache/storage/mooncake_store/mooncake_store.py:121
standalone_storage: bool
client_server_address: str
enable_ssd_offload: bool = False
ssd_offload_path: Optional[str] = None
tenant_id: str = DEFAULT_TENANT_ID
@staticmethod
def from_file() -> "MooncakeStoreConfig":
"""Load the config from a JSON file."""
if not envs.SGLANG_HICACHE_MOONCAKE_CONFIG_PATH.is_set():
raise RuntimeError(
f"Config file path not set. Please set {envs.SGLANG_HICACHE_MOONCAKE_CONFIG_PATH.name}"
)
file_path = envs.SGLANG_HICACHE_MOONCAKE_CONFIG_PATH.get()
try:
with open(file_path) as fin:
config = json.load(fin)
except Exception as e:
raise RuntimeError(f"Failed to load config from {file_path}: {str(e)}")
if (
"master_server_address" not in config
and "client_server_address" not in config
):
raise ValueError(
"Either master_server_address or client_server_address is required in config file"
)
return MooncakeStoreConfig(
local_hostname=config.get(
"local_hostname", envs.MOONCAKE_LOCAL_HOSTNAME.default
),
metadata_server=config.get(
"metadata_server", envs.MOONCAKE_TE_META_DATA_SERVER.default
),
global_segment_size=_parse_global_segment_size(
config.get(View on GitHub (pinned to 0132848349)
Solutions
- Validate the path exists and is readable
- python -m json.tool config.json to find the syntax error
- Fix the JSON and restart; check mount paths in containers
Defensive patterns
Strategy: try-catch
Validate before calling
import json, os
p = os.environ.get('SGLANG_HICACHE_MOONCAKE_CONFIG_PATH')
if p:
assert os.path.isfile(p) and os.access(p, os.R_OK), f'unreadable: {p}'
json.load(open(p)) # raises early with precise JSONDecodeError Try / catch
try:
cfg = MooncakeStoreConfig.from_file()
except RuntimeError as e:
if 'Failed to load config from' in str(e):
show_config_lint_error(e.__cause__) # actionable JSON error
raise Prevention
- Run python -m json.tool on config in CI
- Mount configs read-only into containers at fixed paths
When it happens
Trigger: from_file() with a nonexistent/wrong path, unreadable file, malformed JSON (trailing commas, comments), or an empty file.
Common situations: Typo in the env var path; config mounted at a different path in the container; JSON written by hand with comments or single quotes.
Related errors
- Failed to parse JSON content from file {normalized_input}
- Invalid JSON mapping: {normalized_input}
- Invalid format: expected a mapping from GPU id to IB device
- Invalid format: keys must be integers (or string representat
- No valid GPU mappings found in JSON
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/cd0f549b578d355b.
Report an issue: GitHub.