SigNoz/signoz · error · basemodel.ApiError
couldn't read response: %w
Error message
couldn't read response: %w
What it means
io.ReadAll on the gateway response body failed after a successful HTTP round trip. Typically a connection reset mid-body or a context cancellation while streaming the response.
Source
Thrown at ee/query-service/app/api/cloudIntegrations.go:346
for k, v := range headers {
req.Header.Set(k, v)
}
client := &http.Client{
Timeout: 10 * time.Second,
}
response, err := client.Do(req)
if err != nil {
return nil, basemodel.InternalError(fmt.Errorf("couldn't make request: %w", err))
}
defer response.Body.Close()
respBody, err := io.ReadAll(response.Body)
if err != nil {
return nil, basemodel.InternalError(fmt.Errorf("couldn't read response: %w", err))
}
var resp ResponseType
err = json.Unmarshal(respBody, &resp)
if err != nil {
return nil, basemodel.InternalError(fmt.Errorf(
"couldn't unmarshal gateway response into %T", resp,
))
}
return &resp, nil
}
View on GitHub (pinned to 5069bf80b0)
Solutions
- Check whether the request context was cancelled upstream
- Retry — mid-body resets are usually transient
- If persistent, inspect network path (LB idle timeouts, MTU) to the gateway
Defensive patterns
Strategy: retry
Try / catch
Retry mid-body read failures once; propagate context cancellation errors without retry.
Prevention
- Avoid cancelling contexts mid-download unnecessarily
- Watch LB idle timeouts on long responses
When it happens
Trigger: The gateway closes the connection before sending the full body, the request context is cancelled during read, or a network device truncates the response.
Common situations: Flaky networks, load balancers with short idle timeouts, client disconnects, or very large responses interrupted mid-transfer.
Related errors
- couldn't make request: %w
- couldn't serialize request payload to JSON: %w
- couldn't prepare request: %w
- ErrCodeInvalidGatewayConfig
- gateway_unsupported
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/0e2a9141a683d69d.
Report an issue: GitHub.