goreleaser/goreleaser · error
could not read response: %w
Error message
could not read response: %w
What it means
After a successful HTTP round-trip, the MCP publish pipe reads the entire response body with io.ReadAll; if that fails, the body read failed mid-stream (connection dropped, truncated response). Notably this error is NOT wrapped in retryx.HTTP, so it is not retried and aborts the publish.
Source
Thrown at internal/pipe/mcp/mcp.go:185
publishURL := p.registry + "/v0/publish"
return retryx.Do(ctx, ctx.Config.Retry, func() error {
req, err := http.NewRequestWithContext(ctx, http.MethodPost, publishURL, bytes.NewReader(jsonData))
if err != nil {
return retryx.Unrecoverable(fmt.Errorf("could not create request: %w", err))
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
return retryx.HTTP(fmt.Errorf("could not send request: %w", err), resp)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return fmt.Errorf("could not read response: %w", err)
}
if resp.StatusCode != http.StatusCreated && resp.StatusCode != http.StatusOK {
return retryx.HTTP(fmt.Errorf("got status code %d: %s", resp.StatusCode, string(body)), resp)
}
var serverResponse apiv0.ServerResponse
if err := json.Unmarshal(body, &serverResponse); err != nil {
return fmt.Errorf("could not parse response: %w", err)
}
log.
WithField("name", server.Name).
WithField("status", serverResponse.Meta.Official.Status).
Info("published to MCP registry")
summary.Appendf("Published `%s` to the MCP registry", server.Name)
return nilView on GitHub (pinned to f5edd73956)
Solutions
- Re-run the release; this is usually transient — if frequent, investigate the network path/proxy between the runner and the registry.
- Check the registry server logs/load balancer timeout settings (idle/response timeouts that cut responses).
- Ensure any proxy keeps the connection alive for the duration of the publish response.
- Wrap the release step with an outer retry in CI if the registry is known to be flaky.
Defensive patterns
Strategy: retry
Try / catch
if strings.Contains(err.Error(), "could not read response") {
// transient body-read failure: rerun the release or the publish step
} Prevention
- Check proxy/load-balancer idle timeouts between runner and registry.
- Re-run transient failures in CI with an outer job-level retry.
- Monitor the registry's status/health endpoint during releases.
When it happens
Trigger: io.ReadAll(resp.Body) errors while draining the /v0/publish response — the server closed the connection early, a proxy terminated the stream, or a chunked response was interrupted.
Common situations: An intermediary (load balancer, corporate proxy) kills long-lived responses; registry server under load resets the connection; flaky CI network dropping connections mid-response.
Related errors
- could not create request: %w
- could not send request: %w
- got status code %d: %s
- could not parse response: %w
- could not read response from opencollective: %w
AI-assisted analysis of goreleaser/goreleaser@f5edd73956 (2026-09-05).
Data as JSON: /api/errors/d40a4b05f2acca5e.
Report an issue: GitHub.