{"record":{"id":"068a15d5497ab9e8","repo":"JuliusBrussee/caveman","slug":"cachebench-provider-response-read-failed","errorCode":null,"errorMessage":"cachebench: provider response read failed","messagePattern":"cachebench: provider response read failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/replay_http.go","lineNumber":154,"sourceCode":"\t}\n\trequest, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), bytes.NewReader(outbound.Body))\n\tif err != nil {\n\t\treturn ReplayResponse{}, errors.New(\"cachebench: could not build provider request\")\n\t}\n\trequest.Header.Set(\"content-type\", \"application/json\")\n\trequest.Header.Set(\"accept\", \"application/json\")\n\trequest.Header.Set(\"user-agent\", \"caveman-cachebench-replay/1\")\n\tif err := transport.authorize(provider, outbound.Region, request, outbound.Body); err != nil {\n\t\treturn ReplayResponse{}, err\n\t}\n\tresponse, err := transport.client.Do(request)\n\tif err != nil {\n\t\treturn ReplayResponse{}, errors.New(\"cachebench: provider request failed\")\n\t}\n\tdefer response.Body.Close()\n\tbody, err := io.ReadAll(io.LimitReader(response.Body, transport.maxResponseBytes+1))\n\tif err != nil {\n\t\treturn ReplayResponse{StatusCode: response.StatusCode}, errors.New(\"cachebench: provider response read failed\")\n\t}\n\tif int64(len(body)) > transport.maxResponseBytes {\n\t\treturn ReplayResponse{StatusCode: response.StatusCode}, errors.New(\"cachebench: provider response exceeds configured limit\")\n\t}\n\treturn ReplayResponse{\n\t\tStatusCode: response.StatusCode, Body: body,\n\t\tProviderRequestID: providerRequestID(response.Header),\n\t}, nil\n}\n\nfunc (transport *HTTPReplayTransport) endpoint(provider string, outbound ReplayOutbound) (*url.URL, error) {\n\tif !validBoundedText(outbound.Model, 512, false) {\n\t\treturn nil, errors.New(\"cachebench: invalid replay model\")\n\t}\n\tbase := transport.baseURLs[provider]\n\tif provider == \"bedrock\" && base == nil {\n\t\tif !validAWSRegion(outbound.Region) {\n\t\t\treturn nil, errors.New(\"cachebench: invalid Bedrock region\")","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cachebench/replay_http.go#L136-L172","documentation":"Reading the provider's HTTP response body failed: io.ReadAll over an io.LimitReader wrapping response.Body returned an error (connection reset mid-body, read timeout, decompression failure). The returned ReplayResponse still carries the status code so callers can attribute the partial exchange, but the body is discarded.","triggerScenarios":"Thrown at cacheengine/cachebench/replay_http.go:154 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the replay request; the transport does not auto-retry","Check for provider-side instability or proxy interference"],"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-23T08:17:48.524Z"}