{"record":{"id":"f28314194269cfcf","repo":"alibaba/open-code-review","slug":"invalid-custom-provider-key-q-expected-custom-pr","errorCode":null,"errorMessage":"invalid custom provider key %q: expected custom_providers.<name>.<field>","messagePattern":"invalid custom provider key %q: expected custom_providers\\.<name>\\.<field>","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/opencodereview/config_cmd.go","lineNumber":811,"sourceCode":"\t}\n\tif _, isPreset := llm.LookupProvider(parts[1]); !isPreset {\n\t\treturn setCustomProviderField(cfg, parts[1], parts[2], key, value)\n\t}\n\tif cfg.Providers == nil {\n\t\tcfg.Providers = make(map[string]ProviderEntry)\n\t}\n\tentry := cfg.Providers[parts[1]]\n\tif err := applyProviderField(parts[1], &entry, parts[2], key, value); err != nil {\n\t\treturn err\n\t}\n\tcfg.Providers[parts[1]] = entry\n\treturn nil\n}\n\nfunc setCustomProviderValue(cfg *Config, key, value string) error {\n\tparts := strings.SplitN(key, \".\", 3)\n\tif len(parts) != 3 || parts[1] == \"\" || parts[2] == \"\" {\n\t\treturn fmt.Errorf(\"invalid custom provider key %q: expected custom_providers.<name>.<field>\", key)\n\t}\n\tif preset, isPreset := llm.LookupProvider(parts[1]); isPreset {\n\t\treturn fmt.Errorf(\"custom provider name %q conflicts with a preset provider; use providers.%s.%s to configure the preset or choose a different custom provider name\", parts[1], preset.Name, parts[2])\n\t}\n\treturn setCustomProviderField(cfg, parts[1], parts[2], key, value)\n}\n\nfunc isAuxiliaryProviderField(field string) bool {\n\tswitch field {\n\tcase \"extra_body\", \"extra_headers\", \"retry_codes\":\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n\nfunc setCustomProviderField(cfg *Config, name, field, key, value string) error {\n\tif _, exists := cfg.CustomProviders[name]; isAuxiliaryProviderField(field) && !exists {","sourceCodeStart":793,"sourceCodeEnd":829,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/cmd/opencodereview/config_cmd.go#L793-L829","documentation":"setCustomProviderValue expects keys of the form custom_providers.<name>.<field>. A key that does not split into exactly three non-empty segments is rejected with this message, distinguishing it from the preset-provider (providers.*) key format.","triggerScenarios":"`ocr config set custom_providers <value>` or `ocr config set custom_providers.myprovider` (missing field), or keys like custom_providers..api_key with an empty name segment.","commonSituations":"Using providers.* syntax for a custom provider or vice versa; scripts building keys from variables where the field variable is empty; copy-paste truncating the key.","solutions":["Use the full key: ocr config set custom_providers.<name>.<field> <value>","If the target is a preset provider, switch to providers.<name>.<field>","Ensure the name and field segments are non-empty"],"exampleFix":"// before\nocr config set custom_providers.myprovider\n// after\nocr config set custom_providers.myprovider.api_key sk-...","handlingStrategy":"validation","validationCode":"key=\"custom_providers.myprovider.api_key\"\ncount=$(awk -F. '{print NF}' <<< \"$key\")\n[[ \"$count\" -eq 3 ]] || echo \"key must be custom_providers.<name>.<field>\"","typeGuard":null,"tryCatchPattern":"parts := strings.SplitN(key, \".\", 3)\nif len(parts) != 3 || parts[1] == \"\" || parts[2] == \"\" {\n    return fmt.Errorf(\"invalid custom provider key %q: expected custom_providers.<name>.<field>\", key)\n}","preventionTips":["Verify the full custom_providers.<name>.<field> shape before running","Do not mix providers.* and custom_providers.* key styles","Confirm environment variables feeding the key are set"],"tags":["cli","config","key-format"],"backgroundTag":"invalid-config-key-format","analyzedSha":"5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f","analyzedAt":"2026-09-02T02:08:09.116Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}