alibaba/open-code-review · error
unset supports provider, max_tokens, effort, custom_provider
Error message
unset supports provider, max_tokens, effort, custom_providers.<name>, and mcp_servers.<name>
What it means
runConfigUnset only supports the scalar keys provider, max_tokens, effort and dotted keys of the form custom_providers.<name> or mcp_servers.<name>. When the key has no dot separator, or the part after the dot is empty, this guidance error is returned listing the accepted shapes.
Source
Thrown at cmd/opencodereview/config_cmd.go:167
func runConfigUnset(key string) error {
configPath, err := defaultConfigPath()
if err != nil {
return err
}
if key == "provider" {
return unsetActiveProvider(configPath)
}
if key == "max_tokens" {
return unsetMaxTokens(configPath)
}
if key == "effort" {
return unsetEffort(configPath)
}
parts := strings.SplitN(key, ".", 2)
if len(parts) != 2 || parts[1] == "" {
return fmt.Errorf("unset supports provider, max_tokens, effort, custom_providers.<name>, and mcp_servers.<name>")
}
switch parts[0] {
case "custom_providers":
return unsetCustomProvider(configPath, parts[1])
case "mcp_servers":
return unsetMCPServer(configPath, parts[1])
default:
return fmt.Errorf("unset supports provider, max_tokens, effort, custom_providers.<name>, and mcp_servers.<name>")
}
}
func unsetMaxTokens(configPath string) error {
cfg, err := loadOrCreateConfig(configPath)
if err != nil {
return fmt.Errorf("load config: %w", err)
}
View on GitHub (pinned to 5cf97d0d15)
Solutions
- Name the entry: `ocr config unset custom_providers.my-gateway` or `ocr config unset mcp_servers.github`.
- For scalar settings use the exact bare keys: `ocr config unset provider`, `unset max_tokens`, or `unset effort`.
- Consult `ocr config unset --help` / the Long help for the supported key list.
- For nested llm.* or telemetry.* keys there is no unset — set them to empty/default values via `ocr config set` instead.
Example fix
// before ocr config unset custom_providers // after ocr config unset custom_providers.my-gateway
Defensive patterns
Strategy: validation
Validate before calling
// shell: enforce supported unset key shapes before invoking key="$1" case "$key" in provider|max_tokens|effort) ;; custom_providers.?*|mcp_servers.?*) ;; *) echo "invalid unset key: $key"; exit 1 ;; esac
Try / catch
out, err := exec.Command("ocr", "config", "unset", key).CombinedOutput()
if err != nil && strings.Contains(string(out), "unset supports") {
return fmt.Errorf("key %q not unsettable; supported: provider, max_tokens, effort, custom_providers.<name>, mcp_servers.<name>", key)
} Prevention
- Only call unset for provider, max_tokens, effort, custom_providers.<name>, mcp_servers.<name>.
- Never pass a bare section name or a key ending with a dot.
- For llm.*/telemetry.*/providers.* keys, overwrite via `config set` with empty/default values instead.
- Validate script variables are non-empty before interpolating into dotted keys.
When it happens
Trigger: Running `ocr config unset <key>` where key contains no '.' (and is not provider/max_tokens/effort) or ends with '.', e.g. `ocr config unset custom_providers`, `ocr config unset custom_providers.`, `ocr config unset mcp_servers`, `ocr config unset llm`.
Common situations: Trying to unset an entire section name without a target; guessing key syntax instead of using `ocr config unset --help`; trying to unset unsupported keys like llm.url or language; a script variable that is empty producing `custom_providers.`.
Related errors
- load config: %w
- MCP server %q not found
- custom provider %q not found
- read app config %s: %w
- invalid max_tokens %q: must be a positive integer
AI-assisted analysis of alibaba/open-code-review@5cf97d0d15 (2026-09-02).
Data as JSON: /api/errors/908300b4021d2134.
Report an issue: GitHub.