vllm-project/vllm · error · ValueError

Size cannot be empty.

Error message

Size cannot be empty.

What it means

_parse_size rejects size strings that are empty or whitespace-only, before unit parsing begins. This is distinct from error 532 (wrong type) and 534 (malformed non-empty string).

Source

Thrown at vllm/distributed/kv_transfer/kv_connector/v1/mooncake/store/worker.py:203

            f"tenant_id must be a string or null, got {type(value).__name__}: {value!r}"
        )
    tenant_id = value.strip()
    return tenant_id if tenant_id else DEFAULT_TENANT_ID


def _parse_size(value: Any) -> int:
    """Parse storage size strings with units: GB, MB, KB, B."""
    if isinstance(value, int):
        return value
    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:

View on GitHub (pinned to c794754062)

Solutions

  1. Provide a real value such as "1GB"
  2. Delete the key so the DEFAULT_LOCAL_BUFFER_SIZE / DEFAULT_GLOBAL_SEGMENT_SIZE fallback applies

Example fix

// before
{ "local_buffer_size": "" }

// after
{ "local_buffer_size": "1GB" }
Defensive patterns

Strategy: validation

Validate before calling

v = raw.get(key)
if isinstance(v, str) and not v.strip():
    raise ValueError(f"{key} must not be an empty string; remove the key to use the default")

Prevention

When it happens

Trigger: "local_buffer_size": "" or " " in the mooncake config JSON.

Common situations: Helm/Jinja templates rendering an empty default; optional fields set to empty strings to 'unset' them.

Related errors


AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14). Data as JSON: /api/errors/448a762676be0652. Report an issue: GitHub.