vllm-project/vllm · error · ValueError

No selectable items found.

Error message

No selectable items found.

What it means

choose_from_menu() renders a numbered selection list but refuses empty input: if the caller passes zero items (e.g. search scoring filtered everything out, or a model has no hardware entries), it raises ValueError('No selectable items found.') before prompting.

Source

Thrown at tools/recipes/recipe_json_to_vllm_config.py:203

        elif tokens and all(token in text for token in tokens):
            score = 800.0
        elif tokens and any(token in text for token in tokens):
            score = 500.0
        else:
            ratio = difflib.SequenceMatcher(None, q, hf_id).ratio()
            if ratio < 0.30:
                continue
            score = ratio * 100.0

        scored.append((score, model))

    scored.sort(key=lambda pair: (-pair[0], str(pair[1].get("hf_id", "")).lower()))
    return [model for _, model in scored[:limit]]


def choose_from_menu(items: list[Any], label_fn, prompt_text: str) -> Any:
    if not items:
        raise ValueError("No selectable items found.")

    if len(items) == 1:
        print(f"Selected: {label_fn(items[0])}")
        return items[0]

    for index, item in enumerate(items, start=1):
        print(f"  [{index}] {label_fn(item)}")

    while True:
        answer = prompt(prompt_text)
        try:
            index = int(answer)
        except ValueError:
            print(f"Enter a number from 1 to {len(items)}.")
            continue
        if 1 <= index <= len(items):
            return items[index - 1]
        print(f"Enter a number from 1 to {len(items)}.")

View on GitHub (pinned to c794754062)

Solutions

  1. Broaden the --model query (e.g. 'llama' instead of a full HF repo name) so at least one candidate passes scoring.
  2. Verify the model actually has recipes by checking the Recipes API/models.json listing.
  3. Update to a current checkout in case scoring cutoffs or API paths changed.

Example fix

# before
python tools/recipes/recipe_json_to_vllm_config.py --model "meta-llama/Llama-3.1-70B-Instruct-GPTQ-Int4"
# -> ValueError: No selectable items found.

# after
python tools/recipes/recipe_json_to_vllm_config.py --model "llama 3.1 70b"
Defensive patterns

Strategy: validation

Validate before calling

matches = search_models(models, query)
if not matches:
    raise SystemExit(f"No candidates for {query!r}; broaden the search term")
# only then call the interactive menu

Type guard

def has_candidates(items: list) -> bool:
    return bool(items)

Prevention

When it happens

Trigger: A model search whose results all score below the 0.30 similarity cutoff in search_models(), so the scored list handed to the menu is empty; or by_hardware mapping having no keys for the selected model.

Common situations: Querying the Recipes API for a model family that exists in models.json but has no published recipes yet; a stale API base URL returning sparse data; overly specific search strings.

Related errors


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