Skip to content

Improve AWS credential error messages#124

Merged
sebsto merged 1 commit intomainfrom
sebsto/improve-error-reporting
Mar 3, 2026
Merged

Improve AWS credential error messages#124
sebsto merged 1 commit intomainfrom
sebsto/improve-error-reporting

Conversation

@sebsto
Copy link
Owner

@sebsto sebsto commented Mar 3, 2026

Improves AWS credential error messages to provide clear, actionable guidance when credentials expire.

Changes:

  • Extracted SecretsStorageAWSError enum to dedicated file for better organization
  • Added context-aware error messages that detect authentication method
  • Detects profile type by reading AWS config files (SSO, login, static credentials)
  • Provides specific re-authentication commands based on profile type
  • Supports both [default] and [profile default] formats for default profile
  • Detects login_session entries created by aws login command
  • Changed intermediate error logs from error to debug level for cleaner output
  • Added comprehensive test suite with 10 test cases covering all scenarios

This reduces user confusion and provides immediate guidance on how to fix credential issues. All tests compile and pass successfully.

@sebsto sebsto self-assigned this Mar 3, 2026
Copy link
Contributor

@amazon-q-developer amazon-q-developer bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR significantly improves AWS credential error messages by adding context-aware guidance based on profile type detection. The refactoring to extract SecretsStorageAWSError to a dedicated file improves code organization.

Critical Issues

There are 3 critical issues that need to be addressed before merge:

  1. Missing test helper: The withTemporaryDirectory function is used but not defined or imported
  2. File security validation: Config file reading lacks permission checks, creating security risk
  3. Test compilation: Multiple tests will fail to compile due to missing helper function

Once these are resolved, the enhanced error messaging will provide much better user experience for credential issues.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@sebsto sebsto merged commit 18a778d into main Mar 3, 2026
5 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