alibaba/open-code-review · error
URL is required for manual configuration
Error message
URL is required for manual configuration
What it means
applyManualConfig requires a URL when saving a manually configured provider, and refuses to persist a config without one. This is a validation error from the provider TUI's confirm step: the manual path stores url/model/auth fields directly, so an empty URL would produce a config that endpoint resolution can never use.
Source
Thrown at cmd/opencodereview/provider_cmd.go:105
func removeModels(existing, toRemove []string) []string {
removeSet := make(map[string]struct{}, len(toRemove))
for _, m := range toRemove {
removeSet[m] = struct{}{}
}
result := make([]string, 0, len(existing))
for _, m := range existing {
if _, found := removeSet[m]; found {
continue
}
result = append(result, m)
}
return result
}
func applyManualConfig(configPath string, cfg *Config, result providerTUIResult) error {
if result.url == "" {
return fmt.Errorf("URL is required for manual configuration")
}
if result.model == "" {
return fmt.Errorf("model is required for manual configuration")
}
cfg.Provider = ""
cfg.Model = ""
cfg.Llm.URL = result.url
cfg.Llm.Model = result.model
cfg.Llm.AuthToken = result.apiKey
authHeader, err := llm.NormalizeAuthHeader(result.authHeader)
if err != nil {
return fmt.Errorf("invalid auth_header: %w", err)
}
cfg.Llm.AuthHeader = authHeader
// Write the canonical protocol so resolver picks it up directly. Also
// mirror use_anthropic so configs read correctly on older binaries that
// predate llm.protocol: anthropic -> true, the OpenAI family (includingView on GitHub (pinned to 5cf97d0d15)
Solutions
- Reopen `ocr config provider`, choose manual configuration, and enter the full base URL (including e.g. /v1).
- If you intended a known provider, pick it from the provider list instead of the manual path so defaults fill in the URL.
- In code/tests, set result.url before calling applyManualConfig.
Example fix
// before
result := providerTUIResult{model: "gpt-4o"}
// after
result := providerTUIResult{url: "https://api.openai.com/v1", model: "gpt-4o"} Defensive patterns
Strategy: validation
Validate before calling
if result.url == "" {
return errors.New("URL is required for manual configuration")
}
u, err := url.Parse(result.url)
if err != nil || u.Scheme == "" || u.Host == "" {
return errors.New("URL must be absolute, e.g. https://api.example.com/v1")
} Try / catch
if err := applyManualConfig(path, cfg, result); err != nil {
if strings.Contains(err.Error(), "URL is required") {
// re-prompt for the URL
}
} Prevention
- Fill in every required field (URL and model) before confirming the TUI.
- Use full absolute URLs including the API path prefix (/v1).
- Prefer built-in provider selection, which defaults these fields.
When it happens
Trigger: Confirming the manual-configuration screen of `ocr config provider` with the URL field left empty; programmatically calling applyManualConfig with a providerTUIResult whose url field is "".
Common situations: Skipping past the URL field in the TUI assuming a default exists; accidentally clearing the field while editing; test harness constructing providerTUIResult without setting url.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- model is required for manual configuration
- invalid max_tokens %q: must be a positive integer
- unknown config key: %s Supported keys: %s Provider fields: a
- invalid URL for %s: %w
- invalid model list for %s: %w
AI-assisted analysis of alibaba/open-code-review@5cf97d0d15 (2026-09-02).
Data as JSON: /api/errors/ff5e0ac592c19531.
Report an issue: GitHub.