sgl-project/sglang · error · ValueError
extra_config[{!r}] must be a boolean-like value (true/false,
Error message
extra_config[{!r}] must be a boolean-like value (true/false, 1/0, yes/no, on/off), got {!r} What it means
Strict boolean coercion for an extra_config key failed: the value is neither bool/int nor one of the accepted strings ('true'/'false','1'/'0','yes'/'no','on'/'off' after strip/lower).
Source
Thrown at python/sglang/srt/mem_cache/storage/umbp/umbp_store.py:79
_TRUE_STRINGS = frozenset({"1", "true", "yes", "on"})
_FALSE_STRINGS = frozenset({"0", "false", "no", "off"})
def _strict_bool(value: Any, key: str) -> bool:
"""Strict boolean parse; raises rather than silently inverting (bool("false") is True)."""
if isinstance(value, bool):
return value
if isinstance(value, int):
if value in (0, 1):
return bool(value)
elif isinstance(value, str):
norm = value.strip().lower()
if norm in _TRUE_STRINGS:
return True
if norm in _FALSE_STRINGS:
return False
raise ValueError(
f"extra_config[{key!r}] must be a boolean-like value "
f"(true/false, 1/0, yes/no, on/off), got {value!r}"
)
def _cast_like(current: Any, value: Any, key: str) -> Any:
"""Cast ``value`` to match the type of an existing config attribute."""
if isinstance(current, bool):
return _strict_bool(value, key)
if isinstance(current, int):
return int(value)
if isinstance(current, float):
return float(value)
return str(value)
def _default_node_address() -> str:
try:View on GitHub (pinned to 0132848349)
Solutions
- Fix the value to a boolean-like literal (true/false, 1/0, yes/no, on/off)
- Validate the extra_config dict against the documented schema before constructing the store
Example fix
# before
extra = {'prefault': 'enabled'}
# after
extra = {'prefault': True} Defensive patterns
Strategy: validation
Validate before calling
_BOOLS = {'true':True,'false':False,'1':True,'0':False,'yes':True,'no':False,'on':True,'off':False}
def valid_bool(v):
return isinstance(v, bool) or (isinstance(v, int) and v in (0,1)) or (isinstance(v, str) and v.strip().lower() in _BOOLS)
assert all(valid_bool(v) for k, v in extra.items() if k in BOOL_KEYS) Type guard
def is_boolean_like(v) -> bool:
_B={'true','false','1','0','yes','no','on','off'}
return isinstance(v,bool) or (isinstance(v,int) and v in (0,1)) or (isinstance(v,str) and v.strip().lower() in _B) Prevention
- Use real JSON booleans in extra_config, not strings
- Validate extra_config with a schema before launching the server
When it happens
Trigger: Passing extra_config={'prefault': 'maybe'} or another non-boolean-like value to the UMBP store constructor; _cast_like routes it into _strict_bool which raises ValueError naming the key.
Common situations: Typos in server CLI --storage-extra-config JSON, quoting issues making the value a nested list/dict, or copy-pasted config from a different schema.
Understand the failure class
Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.
Related errors
- hicache_storage_pass_prefix_keys must be bool, got {type(hic
- {} must not be None
- {} must not be empty
- {} has {} entries, but rank_index={}
- extra_config['ssd_io_backend'] must be one of: posix, io_uri
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/5d843191027452c3.
Report an issue: GitHub.