-
Notifications
You must be signed in to change notification settings - Fork 37
Closed
Description
The model selector can show an empty list even though providers are connected and /api/opencode/provider returns models.
Root cause
In frontend/src/api/providers.ts (getProvidersFromOpenCodeServer), model mapping assumes openCodeModel.cost.cache.read/write always exists.
Some models (e.g. Google models like gemini-embedding-001) return cost without cache, which throws at runtime.
The outer try/catch then returns an empty provider list.
Reproduce
- Connect providers (e.g. Google/OpenAI) via WebUI or mounted auth (both reproduce).
- Open model selection dialog.
- Ensure
/api/opencode/providerincludes a model withcostbut nocost.cache. - Result: no models are shown in UI.
Expected
Missing optional fields in one model should not break the full provider/model list.
Actual
A single malformed/partial model entry causes the whole list to fail and the UI shows no models.
Suggested fix
- Make mapping defensive:
cache_read: openCodeModel.cost?.cache?.read ?? 0cache_write: openCodeModel.cost?.cache?.write ?? 0
- Optionally isolate errors per model/provider so one bad entry doesn't drop the entire list.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels