{"record":{"id":"b1b900c4ef95a466","repo":"alibaba/open-code-review","slug":"unknown-config-key-s-supported-keys-s-provider","errorCode":null,"errorMessage":"unknown config key: %s\nSupported keys: %s\nProvider fields: api_key, api_key_cmd, url, protocol, model, models, auth_header, extra_body, extra_headers, retry_codes, aws_region, aws_profile\nProtocol values: anthropic, anthropic-bedrock, openai, openai-responses\nMCP server fields","messagePattern":"unknown config key: (.+?)\nSupported keys: (.+?)\nProvider fields: api_key, api_key_cmd, url, protocol, model, models, auth_header, extra_body, extra_headers, retry_codes, aws_region, aws_profile\nProtocol values: anthropic, anthropic-bedrock, openai, openai-responses\nMCP server fields","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/opencodereview/config_cmd.go","lineNumber":605,"sourceCode":"\t\tcfg.ensureTelemetry()\n\t\tcfg.Telemetry.ContentLog = b\n\tcase \"llm.extra_body\", \"llm.ExtraBody\":\n\t\tvar m map[string]any\n\t\tif err := json.Unmarshal([]byte(value), &m); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid JSON for llm.extra_body: %w\", err)\n\t\t}\n\t\tcfg.Llm.ExtraBody = m\n\tcase \"llm.retry_codes\", \"llm.RetryCodes\":\n\t\tcodes, warnings, err := llm.ParseRetryCodes(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, w := range warnings {\n\t\t\tfmt.Fprintf(os.Stderr, \"[ocr] WARNING: %s\\n\", w)\n\t\t}\n\t\tcfg.Llm.RetryCodes = codes\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown config key: %s\\nSupported keys: %s\\nProvider fields: api_key, api_key_cmd, url, protocol, model, models, auth_header, extra_body, extra_headers, retry_codes, aws_region, aws_profile\\nProtocol values: anthropic, anthropic-bedrock, openai, openai-responses\\nMCP server fields: type, command, args, env, url, headers, tools, setup\", key, strings.Join(supportedConfigKeys, \", \"))\n\t}\n\treturn nil\n}\n\nfunc applyProviderField(providerName string, entry *ProviderEntry, field, key, value string) error {\n\tswitch field {\n\tcase \"api_key\":\n\t\tentry.APIKey = value\n\tcase \"api_key_cmd\":\n\t\tentry.APIKeyCmd = value\n\tcase \"url\":\n\t\ttrimmedURL := strings.TrimSpace(value)\n\t\tif trimmedURL != \"\" {\n\t\t\tif err := validateBaseURL(trimmedURL); err != nil {\n\t\t\t\treturn fmt.Errorf(\"invalid URL for %s: %w\", key, err)\n\t\t\t}\n\t\t}\n\t\tentry.URL = trimmedURL","sourceCodeStart":587,"sourceCodeEnd":623,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/cmd/opencodereview/config_cmd.go#L587-L623","documentation":"setConfigValue only accepts a fixed set of top-level keys (enumerated in supportedConfigKeys, which the error message prints). Any key outside the providers./custom_providers./mcp_servers. prefixes and the known switch cases produces this error listing all supported keys and provider fields.","triggerScenarios":"`ocr config set <key> <value>` with a typo'd or nonexistent key, a deprecated key removed in a newer version, or a provider field applied at the top level instead of under providers.<name>.<field>.","commonSituations":"Typos like `maxtoken` or `telemetry_enable`; applying `api_key` directly instead of `providers.<name>.api_key`; old tutorial commands referencing renamed keys; forgetting the `llm.` or `telemetry.` prefix.","solutions":["Copy a supported key exactly from the error's \"Supported keys\" list","For provider settings use the dotted form: `ocr config set providers.<name>.api_key <key>`","Run `ocr config get` (or view the config file) to see keys your config actually uses","If a key was renamed in an upgrade, check the release notes and migrate to the new name"],"exampleFix":"// before\nocr config set api_key sk-...\n// after\nocr config set providers.openai.api_key sk-...","handlingStrategy":"validation","validationCode":"var supported = map[string]bool{\"provider\":true,\"model\":true,\"max_tokens\":true,\"effort\":true,\"language\":true,\n  \"llm.url\":true,\"llm.auth_token\":true,\"llm.auth_token_cmd\":true,\"llm.auth_header\":true,\"llm.model\":true,\n  \"llm.protocol\":true,\"llm.use_anthropic\":true,\"llm.extra_body\":true,\"llm.extra_headers\":true,\"llm.retry_codes\":true,\n  \"telemetry.enabled\":true,\"telemetry.exporter\":true,\"telemetry.otlp_endpoint\":true,\"telemetry.content_logging\":true}\nif !supported[key] && !strings.HasPrefix(key, \"providers.\") &&\n   !strings.HasPrefix(key, \"custom_providers.\") && !strings.HasPrefix(key, \"mcp_servers.\") {\n    return fmt.Errorf(\"unsupported key %q; see error message for the full list\", key)\n}\n_ = runConfigSet(key, value)","typeGuard":null,"tryCatchPattern":"if err := runConfigSet(key, value); err != nil {\n    if strings.Contains(err.Error(), \"unknown config key\") {\n        fmt.Fprintln(os.Stderr, err) // message already lists every supported key\n    }\n}","preventionTips":["Copy key names from the error's Supported keys list, don't type from memory","Provider settings need the dotted form providers.<name>.<field>","Check release notes after upgrading ocr for renamed keys","Use `ocr config get` to inspect existing keys before adding new ones"],"tags":["config","cli","validation"],"backgroundTag":"unknown-config-key","analyzedSha":"5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f","analyzedAt":"2026-09-02T02:08:09.116Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}