sgl-project/sglang · error · ValueError
{} has {} entries, but rank_index={}
Error message
{} has {} entries, but rank_index={} What it means
A per-rank list config has fewer entries than the current rank_index, so no value can be selected for this rank.
Source
Thrown at python/sglang/srt/mem_cache/storage/umbp/umbp_store.py:121
def _select_rank_config_value(
value: Any,
rank_index: int,
field_name: str,
cast_type,
auto_increment_scalar: bool = False,
):
if value is None:
raise ValueError(f"{field_name} must not be None")
candidates = value
if isinstance(value, str) and "," in value:
candidates = [item.strip() for item in value.split(",") if item.strip()]
if isinstance(candidates, (list, tuple)):
if not candidates:
raise ValueError(f"{field_name} must not be empty")
if rank_index >= len(candidates):
raise ValueError(
f"{field_name} has {len(candidates)} entries, but rank_index={rank_index}"
)
return cast_type(candidates[rank_index])
selected = cast_type(candidates)
if auto_increment_scalar:
selected = cast_type(selected + rank_index)
return selected
# extra_config is an explicit allow-list grouped by the scope in which each key
# takes effect (distributed mode is enabled by master_address). Advanced SPDK
# knobs outside this list go through the "spdk_passthrough" escape hatch.
_COMMON_EXTRA_KEYS = frozenset(
{
"dram_capacity_bytes",
"ssd_enabled",
"ssd_storage_dir",View on GitHub (pinned to 0132848349)
Solutions
- Extend the list to at least rank_index+1 entries (ideally one per rank)
- Or use a single scalar, which with auto_increment_scalar is broadcast/incremented per rank
Example fix
# before extra['ssd_paths'] = '/mnt/nvme0,/mnt/nvme1' # tp=4 # after extra['ssd_paths'] = '/mnt/nvme0,/mnt/nvme1,/mnt/nvme2,/mnt/nvme3'
Defensive patterns
Strategy: validation
Validate before calling
vals = rank_list(extra['ssd_paths']) # as in 4947
assert tp_rank < len(vals) or len(vals) == 1, f'need >= {tp_rank+1} entries for tp={tp_size}' Prevention
- Keep per-rank list length == tensor-parallel size
- Use a scalar with auto_increment where the pattern allows
When it happens
Trigger: Passing e.g. numa list with 2 entries while running TP=4 (rank_index 2 or 3), or a comma string '0,1' with rank_index >= 2.
Common situations: Scaling tensor parallelism up without extending per-rank storage config lists (NUMA nodes, SSD paths).
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
- extra_config[{!r}] must be a boolean-like value (true/false,
- {} must not be None
- {} must not be empty
- extra_config['ssd_io_backend'] must be one of: posix, io_uri
- extra_config['ssd_durability_mode'] must be one of: strict,
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/dcc84438d3aa9d40.
Report an issue: GitHub.