vllm-project/vllm · error · ValueError
Invalid format: '{value}'
Error message
Invalid format: '{value}' What it means
_parse_size matches size strings against the regex ^\s*([\d.]+)\s*(gb|mb|kb|b)?\s*$ (case-insensitive). Anything else — "8 GB X", "0x1000", "8tb", "1,024GB", "half" — fails with ValueError('Invalid format'). Only gb/mb/kb/b units (binary multiples) plus bare byte counts are accepted.
Source
Thrown at vllm/distributed/kv_transfer/kv_connector/v1/mooncake/store/worker.py:213
if not isinstance(value, str):
try:
return int(value)
except (TypeError, ValueError) as e:
raise TypeError(f"Unsupported type for size: {type(value)}") from e
cleaned = value.strip().lower()
if not cleaned:
raise ValueError("Size cannot be empty.")
unit_multipliers = {
"gb": 1024**3,
"mb": 1024**2,
"kb": 1024,
"b": 1,
}
match = re.match(r"^\s*([\d.]+)\s*(gb|mb|kb|b)?\s*$", cleaned)
if not match:
raise ValueError(f"Invalid format: '{value}'")
number_str = match.group(1)
unit = match.group(2) or "b"
multiplier = unit_multipliers[unit]
try:
numeric_value = float(number_str)
except ValueError as exc:
raise ValueError(f"Invalid numeric value '{number_str}' in: '{value}'") from exc
return int(numeric_value * multiplier)
def _align_up(value: int, alignment: int) -> int:
return ((value + alignment - 1) // alignment) * alignment
def _estimate_disk_offload_staging_bytes(size_list: list[int]) -> int:
data_size = sum(size_list)View on GitHub (pinned to c794754062)
Solutions
- Convert to a supported unit: "2048GB" instead of "2TB"
- Remove commas/spaces: "1024GB" not "1,024 GB"
- Or use a bare integer byte count
Example fix
// before
{ "global_segment_size": "2TB" }
// after
{ "global_segment_size": "2048GB" } Defensive patterns
Strategy: validation
Validate before calling
import re
SIZE_RE = re.compile(r"^[\d.]+\s*(gb|mb|kb|b)?$", re.I)
v = str(raw.get(key)).strip()
if v and not SIZE_RE.match(v):
raise ValueError(f"{key} must look like '1024MB' or a bare byte count") Prevention
- Convert TB values to GB (only gb/mb/kb/b are supported)
- Avoid thousands separators and stray spaces in size strings
When it happens
Trigger: Using unsupported units (TB/PB), thousands separators, hex, or extra characters in global_segment_size/local_buffer_size.
Common situations: Users writing disk-style sizes ("2TB"), European decimal commas, or pasting values from cloud console quotas.
Related errors
- Unsupported type for size: {type(value)}
- Size cannot be empty.
- Invalid numeric value '{number_str}' in: '{value}'
- numa_bind_cpus entries must not be empty.
- Mooncake Transfer Engine initialization failed.
AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14).
Data as JSON: /api/errors/9c80f6ddf2b75b79.
Report an issue: GitHub.