{"record":{"id":"76bb2fb53553f631","repo":"alibaba/open-code-review","slug":"invalid-extra-headers-for-s-w","errorCode":null,"errorMessage":"invalid extra headers for %s: %w","messagePattern":"invalid extra headers for (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/opencodereview/config_cmd.go","lineNumber":662,"sourceCode":"\t\t\treturn fmt.Errorf(\"invalid model list for %s: %w\", key, err)\n\t\t}\n\t\tentry.Models = models\n\tcase \"auth_header\":\n\t\tnormalized, err := llm.NormalizeAuthHeader(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tentry.AuthHeader = normalized\n\tcase \"extra_body\":\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 %s: %w\", key, err)\n\t\t}\n\t\tentry.ExtraBody = m\n\tcase \"extra_headers\":\n\t\tparsed, err := llm.ParseExtraHeaders(value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid extra headers for %s: %w\", key, err)\n\t\t}\n\t\tentry.ExtraHeaders = parsed\n\tcase \"retry_codes\":\n\t\tcodes, warnings, err := llm.ParseRetryCodes(value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid retry codes for %s: %w\", key, 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\tentry.RetryCodes = codes\n\tcase \"aws_region\", \"aws_profile\":\n\t\tnormalized, err := normalizeAWSSetting(field, key, value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !providerAcceptsAWSSettings(providerName, entry) {\n\t\t\treturn fmt.Errorf(\"%s does not apply to provider %q: aws_region and aws_profile are only used by providers that authenticate from the AWS credential chain (protocol %s)\", field, providerName, llm.ProtocolAnthropicBedrock)","sourceCodeStart":644,"sourceCodeEnd":680,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/cmd/opencodereview/config_cmd.go#L644-L680","documentation":"applyProviderField returns this when llm.ParseExtraHeaders rejects the value given for a provider's 'extra_headers' field. ParseExtraHeaders enforces the expected header format (e.g. key: value pairs), so anything malformed in that format fails here with the field name and underlying reason wrapped in.","triggerScenarios":"`ocr config set providers.<name>.extra_headers \"Bearer token\"` or any value not shaped like parseable headers (missing separator between header name and value, stray commas, empty pairs).","commonSituations":"Users paste an Authorization header value without the 'Name: value' syntax; shell expansion eats colons or quotes; using semicolons instead of commas/newlines between multiple headers.","solutions":["Check the expected format used by llm.ParseExtraHeaders (Name: value pairs) and fix the value","Single-quote the value and retry, e.g. ocr config set providers.foo.extra_headers 'X-Custom: abc'","Test the header string with a small Go snippet or the parse function before storing it"],"exampleFix":"// before\nocr config set providers.foo.extra_headers \"Bearer abc123\"\n// after\nocr config set providers.foo.extra_headers \"Authorization: Bearer abc123\"","handlingStrategy":"validation","validationCode":"h='X-Custom: abc'\n[[ \"$h\" == *\": \"* ]] || [[ \"$h\" == *:* ]] && ocr config set providers.foo.extra_headers \"$h\" || echo \"header must be Name: value\"","typeGuard":null,"tryCatchPattern":"parsed, err := llm.ParseExtraHeaders(value)\nif err != nil {\n    return fmt.Errorf(\"invalid extra headers: %w\", err)\n}","preventionTips":["Always use 'Header-Name: value' syntax","Quote the whole header string in the shell","Test with one header first, then add more"],"tags":["cli","config","headers-validation"],"backgroundTag":"invalid-header-format","analyzedSha":"5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f","analyzedAt":"2026-09-02T02:08:09.116Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}