{"record":{"id":"908300b4021d2134","repo":"alibaba/open-code-review","slug":"unset-supports-provider-max-tokens-effort-custo","errorCode":null,"errorMessage":"unset supports provider, max_tokens, effort, custom_providers.<name>, and mcp_servers.<name>","messagePattern":"unset supports provider, max_tokens, effort, custom_providers\\.<name>, and mcp_servers\\.<name>","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/opencodereview/config_cmd.go","lineNumber":167,"sourceCode":"func runConfigUnset(key string) error {\n\tconfigPath, err := defaultConfigPath()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif key == \"provider\" {\n\t\treturn unsetActiveProvider(configPath)\n\t}\n\tif key == \"max_tokens\" {\n\t\treturn unsetMaxTokens(configPath)\n\t}\n\tif key == \"effort\" {\n\t\treturn unsetEffort(configPath)\n\t}\n\n\tparts := strings.SplitN(key, \".\", 2)\n\tif len(parts) != 2 || parts[1] == \"\" {\n\t\treturn fmt.Errorf(\"unset supports provider, max_tokens, effort, custom_providers.<name>, and mcp_servers.<name>\")\n\t}\n\n\tswitch parts[0] {\n\tcase \"custom_providers\":\n\t\treturn unsetCustomProvider(configPath, parts[1])\n\tcase \"mcp_servers\":\n\t\treturn unsetMCPServer(configPath, parts[1])\n\tdefault:\n\t\treturn fmt.Errorf(\"unset supports provider, max_tokens, effort, custom_providers.<name>, and mcp_servers.<name>\")\n\t}\n}\n\nfunc unsetMaxTokens(configPath string) error {\n\tcfg, err := loadOrCreateConfig(configPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"load config: %w\", err)\n\t}\n","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/cmd/opencodereview/config_cmd.go#L149-L185","documentation":"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.","triggerScenarios":"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`.","commonSituations":"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.`.","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."],"exampleFix":"// before\nocr config unset custom_providers\n// after\nocr config unset custom_providers.my-gateway","handlingStrategy":"validation","validationCode":"// shell: enforce supported unset key shapes before invoking\nkey=\"$1\"\ncase \"$key\" in\n  provider|max_tokens|effort) ;;\n  custom_providers.?*|mcp_servers.?*) ;;\n  *) echo \"invalid unset key: $key\"; exit 1 ;;\nesac","typeGuard":null,"tryCatchPattern":"out, err := exec.Command(\"ocr\", \"config\", \"unset\", key).CombinedOutput()\nif err != nil && strings.Contains(string(out), \"unset supports\") {\n\treturn fmt.Errorf(\"key %q not unsettable; supported: provider, max_tokens, effort, custom_providers.<name>, mcp_servers.<name>\", key)\n}","preventionTips":["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."],"tags":["cli","config","invalid-key"],"backgroundTag":"invalid-config-key","analyzedSha":"5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f","analyzedAt":"2026-09-02T02:08:09.116Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}