sigoden/aichat · error

No models

Error message

No models

What it means

`set_client_models_config` (src/client/common.rs:610) bails with 'No models' during client configuration when the collected model name list is empty — i.e. the user neither selected any models from the fetched /v1/models list nor typed any comma-separated model names at the interactive prompt. Configuration cannot proceed without at least one model.

Solutions

  1. Re-run client configuration and enter at least one model name (comma-separated, e.g. llama3.3,qwen2.5) at the 'LLMs to add' prompt.
  2. Ensure the server is running and api_base is correct so 'Fetching models' succeeds and the interactive multi-select is offered.
  3. Set a valid api_key (config or <CLIENT>_API_KEY env var) so /v1/models can be fetched.
  4. If the provider is a known one, use its built-in config path instead of the OpenAI-compatible generic flow.

Example fix

// before: empty input at 'LLMs to add' -> No models
LLMs to add: 
// after
LLMs to add: llama3.3,qwen2.5
Defensive patterns

Strategy: validation

Validate before calling

let names: Vec<String> = /* collected from fetch or manual input */;
if names.is_empty() {
    anyhow::bail!("Please provide at least one model before configuring the client");
}

Try / catch

match create_openai_compatible_client_config(&client).await {
    Err(e) if e.to_string() == "No models" => eprintln!("Enter model names, e.g. llama3.3,qwen2.5"),
    other => other,
}

Prevention

When it happens

Trigger: Running create_config / create_openai_compatible_client_config for an OpenAI-compatible client where: the fetch_models call failed (network/auth error printed but not fatal), the multi-select was somehow empty, or the manual 'LLMs to add' input was empty/only commas/whitespace.

Common situations: Models fetch failed silently (bad api_base or key) so the fallback manual prompt was given empty input; user pressed Enter without typing models; offline setup against a local server that wasn't running.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of sigoden/aichat@82976d349a (2026-09-09). Data as JSON: /api/errors/47930b155a6bc488. Report an issue: GitHub.

Appendix: source

Thrown at src/client/common.rs:610

    if model_names.is_empty() {
        model_names = prompt_input_string(
            "LLMs to add",
            true,
            Some("Separated by commas, e.g. llama3.3,qwen2.5"),
        )?
        .split(',')
        .filter_map(|v| {
            let v = v.trim();
            if v.is_empty() {
                None
            } else {
                Some(v.to_string())
            }
        })
        .collect::<Vec<_>>();
    }
    if model_names.is_empty() {
        bail!("No models");
    }
    let models: Vec<Value> = model_names
        .iter()
        .map(|v| {
            let l = v.to_lowercase();
            if l.contains("rank") {
                json!({
                    "name": v,
                    "type": "reranker",
                })
            } else if let Ok(true) = EMBEDDING_MODEL_RE.is_match(&l) {
                json!({
                    "name": v,
                    "type": "embedding",
                    "default_chunk_size": 1000,
                    "max_batch_size": 100
                })
            } else if v.contains("vision") {

View on GitHub (pinned to 82976d349a)