{"record":{"id":"19f2edb2720df636","repo":"alibaba/open-code-review","slug":"provider-q-is-not-configured-in-custom-providers","errorCode":null,"errorMessage":"provider %q is not configured in custom_providers","messagePattern":"provider %q is not configured in custom_providers","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/opencodereview/provider_cmd.go","lineNumber":353,"sourceCode":"\tregistryModels := []string(nil)\n\tif preset, isPreset := llm.LookupProvider(cfg.Provider); isPreset {\n\t\tprovider = preset\n\t\tregistryModels = append([]string(nil), preset.Models...)\n\t\tif entry, ok := cfg.Providers[cfg.Provider]; ok {\n\t\t\tcurrentModel = activeModelForProvider(cfg, cfg.Provider, entry)\n\t\t\tprovider.Models = mergeModelLists(provider.Models, entry.Models)\n\t\t\t// Surface the effective Base URL: a configured override takes\n\t\t\t// precedence over the preset default so users can confirm their\n\t\t\t// gateway is in use from the model picker.\n\t\t\tif entry.URL != \"\" {\n\t\t\t\tprovider.BaseURL = entry.URL\n\t\t\t}\n\t\t}\n\t} else {\n\t\tisCustom = true\n\t\tentry, ok := cfg.CustomProviders[cfg.Provider]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"provider %q is not configured in custom_providers\", cfg.Provider)\n\t\t}\n\t\tcurrentModel = activeModelForProvider(cfg, cfg.Provider, entry)\n\t\tprovider.DisplayName = cfg.Provider + \" (custom)\"\n\t\tprovider.Protocol = entry.Protocol\n\t\tprovider.BaseURL = entry.URL\n\t\tprovider.Models = mergeModelLists(entry.Models)\n\t}\n\n\tm := newModelTUIConfig(modelTUIConfig{\n\t\tProvider:       provider,\n\t\tCurrentModel:   currentModel,\n\t\tRegistryModels: registryModels,\n\t\tExistingCfg:    cfg,\n\t\tConfigPath:     configPath,\n\t\tProviderName:   cfg.Provider,\n\t\tIsCustom:       isCustom,\n\t})\n\tp := tea.NewProgram(m)","sourceCodeStart":335,"sourceCodeEnd":371,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/cmd/opencodereview/provider_cmd.go#L335-L371","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before (config.toml)\nprovider = \"my-gateway\"\n[custom_providers]\n  [custom_providers.gateway] # name mismatch\n  url = \"https://gw.example.com\"\n// after\nprovider = \"my-gateway\"\n[custom_providers]\n  [custom_providers.my-gateway]\n  url = \"https://gw.example.com\"\n  models = [\"model-a\"]","handlingStrategy":"validation","validationCode":"cfg, _ := loadOrCreateConfig(configPath)\nif _, isPreset := llm.LookupProvider(cfg.Provider); !isPreset {\n    if _, ok := cfg.CustomProviders[cfg.Provider]; !ok {\n        // add custom_providers entry or rerun provider config\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := runConfigModel(path); err != nil && strings.Contains(err.Error(), \"is not configured in custom_providers\") {\n    // rerun 'ocr config provider' to rebuild the entry\n}","preventionTips":["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"],"tags":["config","consistency","provider","cli"],"backgroundTag":"missing-config-entry","analyzedSha":"5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f","analyzedAt":"2026-09-02T02:08:09.116Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}