Improve S3 error messages for credential and access issues #6669
+231
−56
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR illustrates a potential approach to translating AWS SDK exceptions to standard Java NIO exceptions with clearer error messages. It is not intended to be merged as-is - we're looking for guidance on a better solution.
The Problem
Users see cryptic errors like:
When they should see something like:
What This PR Demonstrates
lookup()andgetS3ObjectMetadata()methodsAccessDeniedException, 404 →NoSuchFileException)IOExceptionThe current implementation relies on fragile string matching to detect credential errors:
This is not a viable solution because:
"Unable to marshall request"pattern catches serialization errors that coincidentally appear when credentials are misconfigured - this is not a reliable indicatorWhat We Need
We're looking for guidance on how to properly detect credential and access issues from AWS SDK exceptions. Is there a more robust approach using exception types, error codes, or the SDK's error handling facilities?
Context
See issue #6668 for the full problem description. The goal is to allow downstream tools like nf-schema to distinguish access errors from other failures.
🤖 Generated with Claude Code