{"record":{"id":"a4ce6e9fd228ca40","repo":"JuliusBrussee/caveman","slug":"rewriter-read-response-w","errorCode":null,"errorMessage":"rewriter: read response: %w","messagePattern":"rewriter: read response: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rewriter/provider.go","lineNumber":206,"sourceCode":"\t\treturn nil, fmt.Errorf(\"rewriter: %s: %w\", endpoint, err)\n\t}\n\t// An injected doer is caller code; a nil response or body must surface as an\n\t// error rather than a panic inside the proxy hot path.\n\tif resp == nil {\n\t\treturn nil, fmt.Errorf(\"rewriter: %s: nil response\", endpoint)\n\t}\n\tif resp.Body == nil {\n\t\tresp.Body = http.NoBody\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode < 200 || resp.StatusCode > 299 {\n\t\tdetail, _ := io.ReadAll(io.LimitReader(resp.Body, maxErrorBody))\n\t\treturn nil, fmt.Errorf(\"rewriter: %s: status %d: %s\", endpoint, resp.StatusCode, strings.TrimSpace(string(detail)))\n\t}\n\traw, err := io.ReadAll(io.LimitReader(resp.Body, maxProviderResponseBody+1))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"rewriter: read response: %w\", err)\n\t}\n\tif len(raw) > maxProviderResponseBody {\n\t\treturn nil, fmt.Errorf(\"rewriter: response exceeds %d bytes\", maxProviderResponseBody)\n\t}\n\treturn raw, nil\n}\n","sourceCodeStart":188,"sourceCodeEnd":213,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/rewriter/provider.go#L188-L213","documentation":"Reading the rewriter provider's (2xx) response body failed at the transport level — a dropped connection mid-body or read timeout. The status line succeeded but the payload could not be fully received, so decoding cannot proceed.","triggerScenarios":"Thrown at rewriter/provider.go:206 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the request; interrupted body reads are typically transient","Increase the read timeout if bodies are large and the connection is slow"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}