vllm-project/vllm · error · ValueError

Invalid numeric value

Error message

Invalid numeric value '{number_str}' in: '{value}'

What it means

After the format regex matches, _parse_size converts the captured numeric group with float(); failure raises this ValueError. In practice the regex ([\d.]+) already excludes most bad input, so this fires on edge cases like "." alone or "1.2.3" that match the regex but are not valid floats.

Solutions

  1. Write the number in plain decimal form: "1.5GB" or "1024MB"
  2. Or use an integer byte count

Example fix

// before
{ "local_buffer_size": "1.2.3GB" }

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

Strategy: validation

Validate before calling

num = str(raw.get(key)).strip().lower().rstrip("gbmkb ")
try:
    float(num)
except ValueError:
    raise ValueError(f"{key} numeric part {num!r} is not a valid number")

Prevention

When it happens

Trigger: Values like ".", "1.2.3", or "..." in size fields — multiple dots that slip through the character-class regex.

Common situations: Truncated copy-paste of a size string; hand-editing that leaves stray dots.

Related errors


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

Appendix: source

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

    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)
    return _align_up(data_size, _DIRECT_IO_ALIGNMENT) + _DIRECT_IO_PADDING_BYTES


def _sum_batch_bytes(sizes: list[list[int]]) -> int:
    return sum(sum(size) for size in sizes)


def _get_usable_disk_offload_buffer_budget_bytes(raw_budget_bytes: int) -> int:
    return max(1, int(raw_budget_bytes * envs.VLLM_MOONCAKE_DISK_STAGING_USABLE_RATIO))

View on GitHub (pinned to c794754062)