vllm-project/vllm · error · ValueError

Expected recipe argv to start with: ['vllm', 'serve', MODEL,

Error message

Expected recipe argv to start with: ['vllm', 'serve', MODEL, ...]. Got: {argv[:4]!r}

What it means

argv_to_config() only accepts argv arrays that begin with exactly ['vllm','serve',MODEL,...] and have at least 3 tokens. Any other program name, subcommand order, or truncated array raises this error, because the converter's whole grammar (model at argv[2], long options from argv[3]) is anchored on that prefix.

Source

Thrown at tools/recipes/recipe_json_to_vllm_config.py:463


def normalize_key(raw_key: str) -> list[str]:
    """
    Convert the CLI key to config-file spelling.

    Only the top-level CLI option name gets underscore -> dash normalization.
    Nested JSON field names after a dot are preserved.
    """
    parts = raw_key.split(".")
    parts[0] = parts[0].replace("_", "-")
    return parts


def argv_to_config(argv: list[Any]) -> dict[str, Any]:
    argv = [str(x) for x in argv]

    if len(argv) < 3 or argv[0:2] != ["vllm", "serve"]:
        raise ValueError(
            "Expected recipe argv to start with: ['vllm', 'serve', MODEL, ...]. "
            f"Got: {argv[:4]!r}"
        )

    model = argv[2]
    if model.startswith("-"):
        raise ValueError(f"Expected model after 'vllm serve', got {model!r}")

    config: dict[str, Any] = {"model": model}

    i = 3
    while i < len(argv):
        token = argv[i]

        # -O3 / -O=3
        if token.startswith("-O") and token != "-O":
            value = token[3:] if token.startswith("-O=") else token[2:]
            merge_value(config, ["optimization-level"], coerce(value))

View on GitHub (pinned to c794754062)

Solutions

  1. jq '.argv' recipe.json and inspect the first four tokens
  2. If the argv is a module invocation, rewrite it to the equivalent ['vllm','serve',MODEL,...] form in the recipe JSON
  3. Confirm you fetched a serving recipe (not bench/offline/multi-process) from the Recipes API
  4. If the API's rendering format changed, update the vllm checkout

Example fix

# before
"argv": ["python", "-m", "vllm", "serve", "meta-llama/Llama-3-8B", "--tp", "2"]
# after
"argv": ["vllm", "serve", "meta-llama/Llama-3-8B", "--tensor-parallel-size", "2"]
Defensive patterns

Strategy: validation

Validate before calling

argv = recipe.get("argv", [])
if len(argv) < 3 or [str(x) for x in argv[0:2]] != ["vllm", "serve"]:
    raise SystemExit(f"argv does not start with vllm serve: {argv[:4]!r}")

Type guard

def is_vllm_serve_argv(argv: list) -> bool:
    argv = [str(x) for x in argv]
    return len(argv) >= 3 and argv[0:2] == ["vllm", "serve"]

Prevention

When it happens

Trigger: Recipe argv like ['python','-m','vllm','serve',...] (module invocation), ['vllm','serve'] with no model, ['vllm','bench','serve',...], or an empty/short array from a malformed recipe.

Common situations: Recipes API changes its rendering to a different launcher form; recipe JSON for a different tool (e.g. benchmark or offline-batch recipes) fed to this converter; manually constructed argv lists in test fixtures.

Related errors


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