Skip to content

fix: wrap errors with %w in s3 storage - #885

Open
terryrankine wants to merge 1 commit into
peak:masterfrom
terryrankine:fix/s3-error-wrapping
Open

terryrankine wants to merge 1 commit into
peak:masterfrom
terryrankine:fix/s3-error-wrapping

Conversation

@terryrankine

@terryrankine terryrankine commented Sep 17, 2026 •

Copy link
Copy Markdown

Context

Two returned errors in storage/s3.go were formatted with %v, which discards the wrapped error and defeats errors.Is / errors.As for callers.

Fix

Use %w in parseEndpoint and setSessionRegion. The debug-only "retryable error: %v" string is untouched since it is never returned.

Tests

TestParseEndpoint: parsing http://[::1 must yield an error that errors.As unwraps to *url.Error. Fails with %v, passes with %w.

Linux, Go 1.24, go test -count=1 -race ./...: all packages ok. gofmt, go vet, staticcheck, unparam, semgrep: clean.

CI note: the test matrix fails before running anything — bitnami/minio:2023.7.18 no longer exists on Docker Hub (fixed by #840). All build and qa jobs pass. The full suite was run locally on Linux as above.

🤖 Generated with Claude Code

Use %w instead of %v in fmt.Errorf for the endpoint parsing and region
fetching errors so callers can inspect the cause with errors.Is and
errors.As. Add a parseEndpoint test that checks an invalid endpoint
error unwraps to *url.Error.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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