{"record":{"id":"47930b155a6bc488","repo":"sigoden/aichat","slug":"no-models","errorCode":null,"errorMessage":"No models","messagePattern":"No models","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/client/common.rs","lineNumber":610,"sourceCode":"    if model_names.is_empty() {\n        model_names = prompt_input_string(\n            \"LLMs to add\",\n            true,\n            Some(\"Separated by commas, e.g. llama3.3,qwen2.5\"),\n        )?\n        .split(',')\n        .filter_map(|v| {\n            let v = v.trim();\n            if v.is_empty() {\n                None\n            } else {\n                Some(v.to_string())\n            }\n        })\n        .collect::<Vec<_>>();\n    }\n    if model_names.is_empty() {\n        bail!(\"No models\");\n    }\n    let models: Vec<Value> = model_names\n        .iter()\n        .map(|v| {\n            let l = v.to_lowercase();\n            if l.contains(\"rank\") {\n                json!({\n                    \"name\": v,\n                    \"type\": \"reranker\",\n                })\n            } else if let Ok(true) = EMBEDDING_MODEL_RE.is_match(&l) {\n                json!({\n                    \"name\": v,\n                    \"type\": \"embedding\",\n                    \"default_chunk_size\": 1000,\n                    \"max_batch_size\": 100\n                })\n            } else if v.contains(\"vision\") {","sourceCodeStart":592,"sourceCodeEnd":628,"githubUrl":"https://github.com/sigoden/aichat/blob/82976d349ad97ac9aae0655ad631dace5e2a6385/src/client/common.rs#L592-L628","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Ensure the server is running and api_base is correct so 'Fetching models' succeeds and the interactive multi-select is offered.","Set a valid api_key (config or <CLIENT>_API_KEY env var) so /v1/models can be fetched.","If the provider is a known one, use its built-in config path instead of the OpenAI-compatible generic flow."],"exampleFix":"// before: empty input at 'LLMs to add' -> No models\nLLMs to add: \n// after\nLLMs to add: llama3.3,qwen2.5","handlingStrategy":"validation","validationCode":"let names: Vec<String> = /* collected from fetch or manual input */;\nif names.is_empty() {\n    anyhow::bail!(\"Please provide at least one model before configuring the client\");\n}","typeGuard":null,"tryCatchPattern":"match create_openai_compatible_client_config(&client).await {\n    Err(e) if e.to_string() == \"No models\" => eprintln!(\"Enter model names, e.g. llama3.3,qwen2.5\"),\n    other => other,\n}","preventionTips":["Ensure the LLM server is running so 'Fetching models' succeeds and the multi-select appears.","Always enter at least one comma-separated model at the 'LLMs to add' prompt.","Check that fetch-model failures (printed above) are fixed rather than ignored.","Provide a valid api_key so /v1/models can be fetched."],"tags":["config","cli","empty-input","rust"],"backgroundTag":"empty-required-field","analyzedSha":"82976d349ad97ac9aae0655ad631dace5e2a6385","analyzedAt":"2026-09-09T18:33:06.139Z","contentChangedAt":"2026-09-09T18:33:06.139Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}