Skip to content

Report the real status code when HTTP retries are exhausted#364

Merged
folbricht merged 1 commit into
masterfrom
fix-http-retry-error
Jul 5, 2026
Merged

Report the real status code when HTTP retries are exhausted#364
folbricht merged 1 commit into
masterfrom
fix-http-retry-error

Conversation

@folbricht

Copy link
Copy Markdown
Owner

When a request kept failing with a 5xx response until ErrorRetry was exhausted, IssueRetryableHttpRequest() returned (0, nil, err) — but err is nil in the 5xx case since the request itself succeeded at the HTTP level. Callers then saw status code 0 with no error detail:

  • GetObject() reported unexpected status code 0 instead of the real 503/502.
  • StoreObject() returned errors.New(string(nil)) — an error with an empty message.

Return the last response's status code and body instead, so callers report what actually happened. The transport-error path is unchanged (status code 0 and a non-nil error, as before).

The new test asserts that GetChunk/HasChunk errors mention the real status code and that StoreChunk errors carry the response body; it fails against the previous code.

When a request kept failing with a 5xx response until ErrorRetry was
exhausted, IssueRetryableHttpRequest returned (0, nil, err) where err is
nil since the request itself succeeded at the HTTP level. Callers then
saw status code 0 with no error detail: GetObject reported "unexpected
status code 0" instead of the real 503, and StoreObject returned an
error with an empty message.

Return the last response's status code and body instead so callers can
report what actually happened.
@folbricht folbricht merged commit 52bc0d3 into master Jul 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant