alibaba/open-code-review · error
provider %q is not configured in custom_providers
Error message
provider %q is not configured in custom_providers
What it means
When cfg.Provider names a provider that is not an official preset, runConfigModel treats it as custom and looks it up in cfg.CustomProviders. If the map has no entry under that name, the config is inconsistent (provider set but its custom entry missing), so the command fails naming the offending provider.
Source
Thrown at cmd/opencodereview/provider_cmd.go:353
registryModels := []string(nil)
if preset, isPreset := llm.LookupProvider(cfg.Provider); isPreset {
provider = preset
registryModels = append([]string(nil), preset.Models...)
if entry, ok := cfg.Providers[cfg.Provider]; ok {
currentModel = activeModelForProvider(cfg, cfg.Provider, entry)
provider.Models = mergeModelLists(provider.Models, entry.Models)
// Surface the effective Base URL: a configured override takes
// precedence over the preset default so users can confirm their
// gateway is in use from the model picker.
if entry.URL != "" {
provider.BaseURL = entry.URL
}
}
} else {
isCustom = true
entry, ok := cfg.CustomProviders[cfg.Provider]
if !ok {
return fmt.Errorf("provider %q is not configured in custom_providers", cfg.Provider)
}
currentModel = activeModelForProvider(cfg, cfg.Provider, entry)
provider.DisplayName = cfg.Provider + " (custom)"
provider.Protocol = entry.Protocol
provider.BaseURL = entry.URL
provider.Models = mergeModelLists(entry.Models)
}
m := newModelTUIConfig(modelTUIConfig{
Provider: provider,
CurrentModel: currentModel,
RegistryModels: registryModels,
ExistingCfg: cfg,
ConfigPath: configPath,
ProviderName: cfg.Provider,
IsCustom: isCustom,
})
p := tea.NewProgram(m)View on GitHub (pinned to 5cf97d0d15)
Solutions
- Add a matching [custom_providers.<name>] entry (URL, model, key) for cfg.Provider, or
- Re-run 'ocr config provider' to re-select and re-create the custom provider entry consistently
- Fix the provider name typo so it matches an existing custom_providers key
Example fix
// before (config.toml) provider = "my-gateway" [custom_providers] [custom_providers.gateway] # name mismatch url = "https://gw.example.com" // after provider = "my-gateway" [custom_providers] [custom_providers.my-gateway] url = "https://gw.example.com" models = ["model-a"]
Defensive patterns
Strategy: validation
Validate before calling
cfg, _ := loadOrCreateConfig(configPath)
if _, isPreset := llm.LookupProvider(cfg.Provider); !isPreset {
if _, ok := cfg.CustomProviders[cfg.Provider]; !ok {
// add custom_providers entry or rerun provider config
}
} Try / catch
if err := runConfigModel(path); err != nil && strings.Contains(err.Error(), "is not configured in custom_providers") {
// rerun 'ocr config provider' to rebuild the entry
} Prevention
- When renaming a custom_providers key, update the top-level provider field in the same edit
- Avoid hand-editing provider/custom_providers pairs; use 'ocr config provider'
- After version upgrades, diff the config against the new schema
When it happens
Trigger: cfg.Provider is a non-preset name and cfg.CustomProviders[cfg.Provider] is absent — e.g. the custom_providers table was renamed/removed or the provider string was edited by hand.
Common situations: Manually editing config.toml and changing provider without adding a matching custom_providers entry; renaming a custom provider key while leaving the top-level provider pointing at the old name; an upgrade migrating config shape and dropping entries; typo in the provider name.
Related errors
- custom provider %q not found
- provider name is required
- model is required
- provider and model are required
- no provider configured. Run 'ocr config provider' first
AI-assisted analysis of alibaba/open-code-review@5cf97d0d15 (2026-09-02).
Data as JSON: /api/errors/19f2edb2720df636.
Report an issue: GitHub.