[Bug] A provider with no "models" list is not rejected: the request is sent with an empty model name
Description
schemas/agents.config.schema.json says a provider needs name and models. The code does not check: source/client-factory.ts:209 turns a missing list into [], and an empty list means "accept any --model". With no --model either, no model is chosen, the banner shows an empty model name, and the server answers with a raw error.
Environment
- OS: Windows 11 (10.0.26300)
- Node version: 22.22.3
- Nanocoder version: 1.31.0 (main at 9d88dda7)
- Provider: Ollama (OpenAI-compatible endpoint)
- Model: none configured
Steps to Reproduce
- Use this config:
{"nanocoder":{"providers":[{"name":"Ollama","baseUrl":"http://localhost:11434/v1"}]}}. - Run
nanocoder --trust-directory run "Reply with the single word OK"(no--model). - Run the same with
--json.
Expected Behavior
Before any request: Provider "Ollama" has no models configured. Add a "models" list in <config path> or pass --model.
Actual Behavior
nanocoder · Ollama · · auto-accept
Bad request: model is required
URL: http://localhost:11434/v1/chat/completions
Response body: {"error":{"message":"model is required","type":"invalid_request_error","param":null,"code":null}}
(exit 1)
Suggested Fix
- After the provider and model are resolved in
source/client-factory.ts(around lines 125-135 and 209), throw aConfigurationErrorwhen the resolved model is empty. Name the provider and the config path. - Test: a provider with no
modelsand no--modelgives that error.
Additional Context
- Related: #1652 (config problems are hidden in
runmode), which also affects how this is shown. - [x] I have searched existing issues to ensure this is not a duplicate
- [x] I can reproduce this issue consistently
- [x] This issue occurs with the latest version of nanocoder
I can take this. I’ll add the missing-model check before client creation, keep explicit --model support, and add a focused regression test.
Hey @CreedTech , assigning this one to you! Just a heads-up for next time: please wait for the assignment before opening a PR. Thanks!