abi/screenshot-to-code · error · ValueError

No model was provided

Error message

No model was provided

What it means

ValueError raised immediately after the stack check when `model` is empty. It guards Llm(model) from receiving an invalid value: an empty model would raise a less clear conversion error, so the explicit check gives an actionable message first.

Source

Thrown at backend/evals/runner.py:220

async def run_image_evals(
    stack: Optional[Stack] = None,
    model: Optional[str] = None,
    n: int = 1,
    input_files: Optional[List[str]] = None,
    diff_mode: bool = False,
    progress_callback: Optional[Callable[[dict[str, Any]], Any | Awaitable[Any]]] = None,
    eval_set: Optional[str] = None,
    eval_session_id: Optional[str] = None,
    skip_input_files: Optional[set[str]] = None,
) -> List[str]:
    evals, briefs_by_id = _resolve_eval_items(input_files, eval_set)
    is_text_set = bool(briefs_by_id)
    INPUT_DIR = "" if is_text_set else _get_input_dir(eval_set)

    if not stack:
        raise ValueError("No stack was provided")
    if not model:
        raise ValueError("No model was provided")

    print("User selected stack:", stack)
    print("User selected model:", model)
    selected_model = Llm(model)
    print(f"Running evals for {selected_model.value} model")
    
    if input_files and len(input_files) > 0:
        print(f"Running on {len(evals)} selected files")
    else:
        print(f"Running on all {len(evals)} files in {INPUT_DIR}")

    output_subfolder = get_eval_output_subfolder(
        stack=stack,
        model=selected_model.value,
    )
    os.makedirs(output_subfolder, exist_ok=True)

    task_coroutines: List[

View on GitHub (pinned to d026163f58)

Solutions

  1. Pass one of the model ids present in the Llm enum (the same list the Settings dialog shows).
  2. Make the UI require a model before the run button is enabled.
  3. If it still fails, log the exact incoming payload — an empty string usually means the caller read the wrong form field.

Example fix

# before
run_evals(stack="html", model="")

# after
run_evals(stack="html", model="gpt-4o")
Defensive patterns

Strategy: type-guard

Validate before calling

if not model or not isinstance(model, str):
    raise ValueError("model is required")
try:
    selected = Llm(model)
except ValueError:
    raise ValueError(f"Unknown model {model!r}")

Type guard

from enum import Enum
def is_valid_model(model: str) -> bool:
    try:
        Llm(model)
        return True
    except ValueError:
        return False

Prevention

When it happens

Trigger: Calling the eval runner with model omitted/None/empty string — e.g. a session UI where no model was selected for the run.

Common situations: Model dropdown left unselected in the eval sessions UI, or an API/slash-command caller forwarding an undefined field.

Related errors


AI-assisted analysis of abi/screenshot-to-code@d026163f58 (2026-08-14). Data as JSON: /api/errors/92de65c8e015c2ed. Report an issue: GitHub.