{"record":{"id":"cfa96f9fe50a9fb4","repo":"alibaba/open-code-review","slug":"invalid-retry-codes-for-s-w","errorCode":null,"errorMessage":"invalid retry codes for %s: %w","messagePattern":"invalid retry codes for (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/opencodereview/config_cmd.go","lineNumber":668,"sourceCode":"\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)\n\t\t}\n\t\tif field == \"aws_region\" {\n\t\t\tentry.AWSRegion = normalized\n\t\t} else {\n\t\t\tentry.AWSProfile = normalized\n\t\t}","sourceCodeStart":650,"sourceCodeEnd":686,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/cmd/opencodereview/config_cmd.go#L650-L686","documentation":"applyProviderField returns this when llm.ParseRetryCodes cannot interpret the value for the 'retry_codes' field. ParseRetryCodes returns the parsed HTTP status codes plus warnings; any unparseable token (non-numeric, out-of-range, malformed list) aborts the assignment with this wrapped error.","triggerScenarios":"`ocr config set providers.<name>.retry_codes \"429, five-hundred\"` or a list containing letters, empty entries, or values outside the valid HTTP status range.","commonSituations":"Typing status-code names instead of numbers; mixing spaces and commas inconsistently; accidental locale/paste artifacts like en-dashes in ranges.","solutions":["Provide a comma-separated list of numeric HTTP status codes, e.g. 429,500,503","Read the [ocr] WARNING lines printed after parsing — they flag suspicious-but-accepted codes","Retry the config set with the corrected list"],"exampleFix":"// before\nocr config set providers.foo.retry_codes \"rate-limit, timeout\"\n// after\nocr config set providers.foo.retry_codes \"429,504\"","handlingStrategy":"validation","validationCode":"codes=\"429,500,503\"\nIFS=',' read -ra arr <<< \"$codes\"\nfor c in \"${arr[@]}\"; do [[ \"$c\" =~ ^[0-9]{3}$ ]] || echo \"bad code: $c\"; done","typeGuard":null,"tryCatchPattern":"codes, warnings, err := llm.ParseRetryCodes(value)\nif err != nil {\n    return fmt.Errorf(\"invalid retry codes: %w\", err)\n}\nfor _, w := range warnings {\n    fmt.Fprintf(os.Stderr, \"[ocr] WARNING: %s\\n\", w)\n}","preventionTips":["Use comma-separated numeric HTTP status codes only","Watch for [ocr] WARNING output after setting retry_codes","Avoid pasting ranges with non-ASCII dashes"],"tags":["cli","config","validation"],"backgroundTag":"invalid-config-value-format","analyzedSha":"5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f","analyzedAt":"2026-09-02T02:08:09.116Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}