vllm-project/vllm · error · ValueError

Strategy {requested!r} is not available for this model/hardw

Error message

Strategy {requested!r} is not available for this model/hardware. Available: {', '.join(strategies)}

What it means

select_strategy() validates --strategy against the strategy ids available for the chosen model/hardware (the recommended one plus alternatives from the recipe JSON). An explicit request matching none of them (case-insensitive) raises ValueError listing valid ids.

Source

Thrown at tools/recipes/recipe_json_to_vllm_config.py:307

    hardware_json_url: str,
    recipe: dict[str, Any],
    requested: str | None,
    interactive: bool,
) -> tuple[str, str]:
    recommended, sources = strategy_sources(api_base, hardware_json_url, recipe)
    strategies = [recommended, *sorted(s for s in sources if s != recommended)]

    if requested:
        selected = next(
            (
                strategy
                for strategy in strategies
                if strategy.lower() == requested.lower()
            ),
            None,
        )
        if selected is None:
            raise ValueError(
                f"Strategy {requested!r} is not available for this model/hardware. "
                f"Available: {', '.join(strategies)}"
            )
        return selected, sources[selected]

    if not interactive:
        return recommended, hardware_json_url

    print("\nAvailable strategies:")

    def strategy_label(strategy: str) -> str:
        if strategy == recommended:
            return f"{strategy} (recommended)"
        return strategy

    selected = choose_from_menu(strategies, strategy_label, "Select strategy: ")
    return selected, sources[selected]

View on GitHub (pinned to c794754062)

Solutions

  1. Use one of the ids listed in the error message.
  2. Run without --strategy to accept the recommended strategy or browse them interactively.
  3. Inspect the recipe JSON's strategy/alternatives fields for the exact available ids.

Example fix

# before
... --model "llama 3.1" --hardware h100 --strategy tp8
# -> ValueError: Strategy 'tp8' is not available ... Available: tp4-pp2, tp2-pp4

# after
... --model "llama 3.1" --hardware h100 --strategy tp4-pp2
Defensive patterns

Strategy: validation

Validate before calling

strategies = {recommended, *sources}
if args.strategy and args.strategy.lower() not in {s.lower() for s in strategies}:
    raise SystemExit(f"Unknown strategy {args.strategy!r}; available: {sorted(strategies)}")

Type guard

def is_known_strategy(requested: str, sources: dict[str, str]) -> bool:
    return requested.lower() in {s.lower() for s in sources}

Prevention

When it happens

Trigger: Passing --strategy with an id not present in the recipe's 'strategy'/'alternatives' mapping, e.g. 'tp8' when only 'tp4-pp2' and 'tp2-pp4' are offered.

Common situations: Assuming a parallelism layout exists for a model/hardware pair that was never benchmarked; typos or renamed strategy ids between recipe versions.

Related errors


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