{"record":{"id":"8d87dfedd25f0a01","repo":"vllm-project/vllm","slug":"expected-recipe-argv-to-start-with-vllm-serv","errorCode":null,"errorMessage":"Expected recipe argv to start with: ['vllm', 'serve', MODEL, ...]. Got: {argv[:4]!r}","messagePattern":"Expected recipe argv to start with: \\['vllm', 'serve', MODEL, \\.\\.\\.\\]\\. Got: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/recipes/recipe_json_to_vllm_config.py","lineNumber":463,"sourceCode":"\n\ndef normalize_key(raw_key: str) -> list[str]:\n    \"\"\"\n    Convert the CLI key to config-file spelling.\n\n    Only the top-level CLI option name gets underscore -> dash normalization.\n    Nested JSON field names after a dot are preserved.\n    \"\"\"\n    parts = raw_key.split(\".\")\n    parts[0] = parts[0].replace(\"_\", \"-\")\n    return parts\n\n\ndef argv_to_config(argv: list[Any]) -> dict[str, Any]:\n    argv = [str(x) for x in argv]\n\n    if len(argv) < 3 or argv[0:2] != [\"vllm\", \"serve\"]:\n        raise ValueError(\n            \"Expected recipe argv to start with: ['vllm', 'serve', MODEL, ...]. \"\n            f\"Got: {argv[:4]!r}\"\n        )\n\n    model = argv[2]\n    if model.startswith(\"-\"):\n        raise ValueError(f\"Expected model after 'vllm serve', got {model!r}\")\n\n    config: dict[str, Any] = {\"model\": model}\n\n    i = 3\n    while i < len(argv):\n        token = argv[i]\n\n        # -O3 / -O=3\n        if token.startswith(\"-O\") and token != \"-O\":\n            value = token[3:] if token.startswith(\"-O=\") else token[2:]\n            merge_value(config, [\"optimization-level\"], coerce(value))","sourceCodeStart":445,"sourceCodeEnd":481,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/tools/recipes/recipe_json_to_vllm_config.py#L445-L481","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["jq '.argv' recipe.json and inspect the first four tokens","If the argv is a module invocation, rewrite it to the equivalent ['vllm','serve',MODEL,...] form in the recipe JSON","Confirm you fetched a serving recipe (not bench/offline/multi-process) from the Recipes API","If the API's rendering format changed, update the vllm checkout"],"exampleFix":"# before\n\"argv\": [\"python\", \"-m\", \"vllm\", \"serve\", \"meta-llama/Llama-3-8B\", \"--tp\", \"2\"]\n# after\n\"argv\": [\"vllm\", \"serve\", \"meta-llama/Llama-3-8B\", \"--tensor-parallel-size\", \"2\"]","handlingStrategy":"validation","validationCode":"argv = recipe.get(\"argv\", [])\nif len(argv) < 3 or [str(x) for x in argv[0:2]] != [\"vllm\", \"serve\"]:\n    raise SystemExit(f\"argv does not start with vllm serve: {argv[:4]!r}\")","typeGuard":"def is_vllm_serve_argv(argv: list) -> bool:\n    argv = [str(x) for x in argv]\n    return len(argv) >= 3 and argv[0:2] == [\"vllm\", \"serve\"]","tryCatchPattern":null,"preventionTips":["Store recipe fixtures as serving recipes only; route bench/offline recipes to other tooling","When constructing argv, always build ['vllm','serve',MODEL,...] verbatim"],"tags":["vllm-recipes","argv-parsing","cli"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}