vllm-project/vllm · error · ValueError
-O is missing its value
Error message
-O is missing its value
What it means
The bare '-O' flag is the last token of argv: the parser expects its value as the next token (i + 1) but i + 1 is past the end of the list, so optimization-level cannot be set and parsing aborts with ValueError('-O is missing its value').
Source
Thrown at tools/recipes/recipe_json_to_vllm_config.py:488
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")
merge_value(config, ["optimization-level"], coerce(argv[i + 1]))
i += 2
continue
# Selected common short aliases.
if token in SHORT_ALIASES:
if i + 1 >= len(argv):
raise ValueError(f"{token} is missing its value")
merge_value(
config,
[SHORT_ALIASES[token]],
coerce(argv[i + 1]),
)
i += 2
continue
if not token.startswith("--"):
raise ValueError(View on GitHub (pinned to c794754062)
Solutions
- jq '.argv' recipe.json and check the last tokens
- Append the missing value ('-O 3') or switch to the attached forms '-O3' / '-O=3' which cannot dangle
- Re-fetch the recipe if the value was lost in rendering/report the malformed recipe
Example fix
# before "argv": ["vllm", "serve", "m", "-O"] # after "argv": ["vllm", "serve", "m", "-O3"]
Defensive patterns
Strategy: validation
Validate before calling
argv = [str(x) for x in recipe["argv"]]
for i, tok in enumerate(argv):
if tok in ("-O", "-tp", "-pp", "-dp") and i + 1 >= len(argv):
raise SystemExit(f"{tok} dangles at end of argv without a value") Prevention
- Prefer attached forms (-O3, --key=value) when authoring argv — they cannot dangle
- Validate that every value-taking token has a successor before feeding argv to the tool
When it happens
Trigger: Recipe argv ending in exactly '-O', e.g. ['vllm','serve','m','-O']; a renderer bug dropping the optimization level value; truncation of the argv array.
Common situations: Recipes API emitting '-O' with a value that got filtered out (e.g. null dropped during JSON rendering); manual editing that removed the trailing value.
Related errors
- Cannot merge nested option {'.'.join(path)!r}: {part!r} is a
- Expected recipe argv to start with: ['vllm', 'serve', MODEL,
- Expected model after 'vllm serve', got {model!r}
- {token} is missing its value
- Unexpected positional/short argument {token!r}. The converte
AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14).
Data as JSON: /api/errors/acbdcffa20e6f33e.
Report an issue: GitHub.