vllm-project/vllm · error · ValueError

Selected model {model.get('hf_id')!r} has no JSON API path.

Error message

Selected model {model.get('hf_id')!r} has no JSON API path.

What it means

Raised by the Recipes API discovery flow in tools/recipes/recipe_json_to_vllm_config.py. After fetching {api_base}/models.json and letting the user pick a model (interactively or via --model), the selected model entry must contain a non-empty string under the 'json' key pointing at its per-model recipe JSON. If that field is missing, null, or not a string, the tool aborts because it has no URL to fetch the recipe from.

Source

Thrown at tools/recipes/recipe_json_to_vllm_config.py:345

def discover_recipe_source(
    api_base: str,
    requested_model: str | None,
    requested_hardware: str | None,
    requested_strategy: str | None,
) -> str:
    print("No recipe JSON supplied; starting Recipes API discovery.")

    models_url = api_url(api_base, "/models.json")
    models_data = load_json(models_url)
    if not isinstance(models_data, list):
        raise ValueError(f"{models_url} did not return a model list.")

    models = [model for model in models_data if isinstance(model, dict)]
    model = select_model(models, requested_model)

    model_json_path = model.get("json")
    if not isinstance(model_json_path, str) or not model_json_path:
        raise ValueError(f"Selected model {model.get('hf_id')!r} has no JSON API path.")

    model_json_url = api_url(api_base, model_json_path)
    model_data = load_json(model_json_url)
    if not isinstance(model_data, dict):
        raise ValueError(f"{model_json_url} did not return a JSON object.")

    recommended = model_data.get("recommended_command")
    if not isinstance(recommended, dict):
        raise ValueError(
            f"Model {model.get('hf_id')!r} has no rendered "
            "recommended_command in the Recipes API."
        )

    raw_by_hardware = recommended.get("by_hardware")
    if not isinstance(raw_by_hardware, dict) or not raw_by_hardware:
        raise ValueError(
            f"Model {model.get('hf_id')!r} has no per-hardware renderings "
            "in recommended_command.by_hardware."

View on GitHub (pinned to c794754062)

Solutions

  1. Inspect the model list yourself (e.g. curl $API_BASE/models.json | jq '.[] | select(.hf_id=="MODEL")') and confirm the 'json' field exists and is a non-empty string
  2. If the field is missing on the server, bypass discovery: fetch a known per-hardware recipe JSON URL and pass it as the positional source argument
  3. If the API schema changed (field renamed), update the checkout of vllm so the converter matches the live API
  4. File/fix the server-side entry if you control the Recipes API deployment

Example fix

# before (discovery hits a model entry without 'json')
python tools/recipes/recipe_json_to_vllm_config.py --model Qwen/Qwen3-8B
# after (pass the per-hardware recipe JSON directly)
curl -o recipe.json https://recipes.vllm.ai/recipes/Qwen/Qwen3-8B/h100.json
python tools/recipes/recipe_json_to_vllm_config.py recipe.json
Defensive patterns

Strategy: validation

Validate before calling

import json, urllib.request
data = json.load(urllib.request.urlopen(f"{API_BASE}/models.json"))
models = [m for m in data if isinstance(m, dict)]
selected = next(m for m in models if m.get("hf_id") == MODEL_ID)
assert isinstance(selected.get("json"), str) and selected["json"], "model entry lacks usable 'json' path"

Type guard

def has_json_path(model: dict) -> bool:
    return isinstance(model.get("json"), str) and bool(model["json"].strip())

Prevention

When it happens

Trigger: Running the converter with no positional source (discovery mode), or with --model HF_ID, where the selected entry in models.json lacks a valid 'json' field. Typically caused by Recipes API schema drift, a partially-published model entry, or a hand-crafted models.json used with --api-base.

Common situations: Pointing --api-base at a mirror/staging Recipes server with incomplete entries; running an outdated checkout against a newer API schema (field renamed, e.g. 'json' -> 'recipe_json'); selecting a model that is listed but has no rendered recipes yet.

Related errors


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