{"record":{"id":"19ac4610332dbc1d","repo":"vllm-project/vllm","slug":"model-json-url-did-not-return-a-json-object","errorCode":null,"errorMessage":"{model_json_url} did not return a JSON object.","messagePattern":"(.+?) did not return a JSON object\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/recipes/recipe_json_to_vllm_config.py","lineNumber":350,"sourceCode":") -> str:\n    print(\"No recipe JSON supplied; starting Recipes API discovery.\")\n\n    models_url = api_url(api_base, \"/models.json\")\n    models_data = load_json(models_url)\n    if not isinstance(models_data, list):\n        raise ValueError(f\"{models_url} did not return a model list.\")\n\n    models = [model for model in models_data if isinstance(model, dict)]\n    model = select_model(models, requested_model)\n\n    model_json_path = model.get(\"json\")\n    if not isinstance(model_json_path, str) or not model_json_path:\n        raise ValueError(f\"Selected model {model.get('hf_id')!r} has no JSON API path.\")\n\n    model_json_url = api_url(api_base, model_json_path)\n    model_data = load_json(model_json_url)\n    if not isinstance(model_data, dict):\n        raise ValueError(f\"{model_json_url} did not return a JSON object.\")\n\n    recommended = model_data.get(\"recommended_command\")\n    if not isinstance(recommended, dict):\n        raise ValueError(\n            f\"Model {model.get('hf_id')!r} has no rendered \"\n            \"recommended_command in the Recipes API.\"\n        )\n\n    raw_by_hardware = recommended.get(\"by_hardware\")\n    if not isinstance(raw_by_hardware, dict) or not raw_by_hardware:\n        raise ValueError(\n            f\"Model {model.get('hf_id')!r} has no per-hardware renderings \"\n            \"in recommended_command.by_hardware.\"\n        )\n\n    by_hardware = {\n        str(hw): path\n        for hw, path in raw_by_hardware.items()","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/tools/recipes/recipe_json_to_vllm_config.py#L332-L368","documentation":"The converter resolved the per-model JSON URL (model['json'] joined with the API base) and fetched it successfully, but the parsed JSON was not an object (e.g. it was a list, string, number, or null). The recipe schema requires a top-level JSON object, so any other shape is rejected immediately after load_json() in discover_recipe_source().","triggerScenarios":"The model['json'] path resolves to an endpoint that returns a JSON array or scalar instead of an object — e.g. a path that actually points at a list endpoint, a stale/cached response, or a proxy returning a JSON-wrapped error like \"not found\".","commonSituations":"Recipes API path layout changes so the 'json' field points at the wrong resource type; a CDN/mirror serving a directory listing (JSON array) instead of the model document; hand-edited models.json entries with incorrect paths.","solutions":["curl the exact model_json_url shown in the error and inspect the top-level JSON type (object vs list)","If the URL is wrong, fix the 'json' path in the models.json source or update to a vllm checkout matching the live API layout","If the content is wrong server-side, fetch a valid per-hardware recipe JSON and pass it positionally to skip this code path"],"exampleFix":"# before\npython tools/recipes/recipe_json_to_vllm_config.py --model org/model  # URL returns [..]\n# after: verify and use the direct hardware recipe\npython tools/recipes/recipe_json_to_vllm_config.py https://recipes.vllm.ai/recipes/org/model/h100.json","handlingStrategy":"validation","validationCode":"import json, urllib.request\nobj = json.load(urllib.request.urlopen(model_json_url))\nif not isinstance(obj, dict):\n    raise SystemExit(f\"{model_json_url} is {type(obj).__name__}, expected object\")","typeGuard":"def is_json_object(x: object) -> bool:\n    return isinstance(x, dict)","tryCatchPattern":null,"preventionTips":["Always fetch recipe JSON from the same API base as the models.json that referenced it","Cache and inspect API responses during development instead of going through the tool blind"],"tags":["vllm-recipes","api-discovery","json-shape"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}