abi/screenshot-to-code · error · ValueError

No stack was provided

Error message

No stack was provided

What it means

ValueError raised at the top of the eval run function when the `stack` parameter is empty/falsy. Stack selects the output technology (e.g. html vs react); evals cannot generate code without knowing it, so the run aborts before resolving eval items further (it runs after _resolve_eval_items but before model coercion).

Source

Thrown at backend/evals/runner.py:218


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)

View on GitHub (pinned to d026163f58)

Solutions

  1. Pass a supported stack value (the same identifiers the main generation route accepts, e.g. 'html' or 'react').
  2. If building a caller, default the field in the UI/route so an empty submit is impossible.
  3. Check the request payload in devtools when triggered from the eval sessions page.

Example fix

# before
run_evals(stack="", model="gpt-4o")

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

Strategy: validation

Validate before calling

if not stack or not isinstance(stack, str):
    raise ValueError("stack is required (e.g. 'html' or 'react')")

Prevention

When it happens

Trigger: Calling the eval runner programmatically or via a UI route with stack omitted, empty string, or None (e.g. a form field the user left blank).

Common situations: Frontend sending an incomplete payload, API consumer not filling the stack field, or a slash-command wrapper that forwards an unset variable.

Related errors


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