vllm-project/vllm · error · ValueError
Expected model after 'vllm serve', got {model!r}
Error message
Expected model after 'vllm serve', got {model!r} What it means
After validating the ['vllm','serve'] prefix, argv_to_config() checks that argv[2] (the model) does not start with '-'. A leading dash means the token is a flag, so the positional model is missing — e.g. ['vllm','serve','--port','8000'] with the model forgotten or placed later.
Source
Thrown at tools/recipes/recipe_json_to_vllm_config.py:470
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))
i += 1
continue
# -O 3
if token == "-O":
if i + 1 >= len(argv):
raise ValueError("-O is missing its value")View on GitHub (pinned to c794754062)
Solutions
- jq '.argv' recipe.json and look at argv[2]
- Insert the model id at position 2 (right after 'serve') in the recipe JSON
- If the recipe is API-rendered with the model missing, report the model's recipe as broken and pick another model/hardware recipe
Example fix
# before "argv": ["vllm", "serve", "--max-model-len", "8192"] # after "argv": ["vllm", "serve", "meta-llama/Llama-3-8B", "--max-model-len", "8192"]
Defensive patterns
Strategy: validation
Validate before calling
argv = [str(x) for x in recipe["argv"]]
if len(argv) > 2 and argv[2].startswith("-"):
raise SystemExit("argv[2] must be the model id, got a flag") Type guard
def argv_has_model(argv: list) -> bool:
argv = [str(x) for x in argv]
return len(argv) >= 3 and not argv[2].startswith("-") Prevention
- Validate the model slot right after validating the vllm serve prefix
- Render model id before flags in any argv you generate
When it happens
Trigger: Recipe rendering that emits flags before the model; model field empty and dropped from argv leaving a flag at index 2; hand-built argv where the model was omitted by accident.
Common situations: Recipes renderer bug for models with empty ids; editing recipe JSON and deleting the model token; schema where the model is supposed to be supplied separately but argv still contains only options.
Related errors
- Expected recipe argv to start with: ['vllm', 'serve', MODEL,
- Unexpected positional/short argument {token!r}. The converte
- Cannot merge nested option {'.'.join(path)!r}: {part!r} is a
- -O is missing its value
- {token} is missing its value
AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14).
Data as JSON: /api/errors/39692cf9121965ee.
Report an issue: GitHub.