{"record":{"id":"676242e4c964aec2","repo":"router-for-me/CLIProxyAPI","slug":"unexpected-status-d-s","errorCode":null,"errorMessage":"unexpected status %d: %s","messagePattern":"unexpected status (.+?): (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/httpfetch/httpfetch.go","lineNumber":47,"sourceCode":"\tfor key, value := range headers {\n\t\tif value != \"\" {\n\t\t\treq.Header.Set(key, value)\n\t\t}\n\t}\n\n\tresp, errDo := client.Do(req)\n\tif errDo != nil {\n\t\treturn nil, fmt.Errorf(\"request failed: %w\", errDo)\n\t}\n\tdefer func() {\n\t\tif errClose := resp.Body.Close(); errClose != nil {\n\t\t\tlog.WithError(errClose).Debug(\"failed to close response body\")\n\t\t}\n\t}()\n\n\tif resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusMultipleChoices {\n\t\tbody, _ := io.ReadAll(io.LimitReader(resp.Body, 4096))\n\t\treturn nil, fmt.Errorf(\"unexpected status %d: %s\", resp.StatusCode, strings.TrimSpace(string(body)))\n\t}\n\n\treader := io.Reader(resp.Body)\n\tif maxSize > 0 {\n\t\treader = io.LimitReader(resp.Body, maxSize+1)\n\t}\n\tdata, errRead := io.ReadAll(reader)\n\tif errRead != nil {\n\t\treturn nil, fmt.Errorf(\"read response: %w\", errRead)\n\t}\n\tif maxSize > 0 && int64(len(data)) > maxSize {\n\t\treturn nil, fmt.Errorf(\"response exceeds maximum allowed size of %d bytes\", maxSize)\n\t}\n\treturn data, nil\n}\n","sourceCodeStart":29,"sourceCodeEnd":63,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/httpfetch/httpfetch.go#L29-L63","documentation":"Error \"unexpected status %d: %s\" thrown in router-for-me/CLIProxyAPI.","triggerScenarios":"Thrown at internal/httpfetch/httpfetch.go:47 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the status code and body for the server's failure reason.","Verify the request URL, credentials, and parameters, then retry."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}