Skip to content

Fix s3 cp returning exit code 0 on upload failure - #10884

Open
KushagraIndurkhya wants to merge 1 commit into
aws:v2from
KushagraIndurkhya:fix/s3-cp-exit-code-10743
Open

KushagraIndurkhya wants to merge 1 commit into
aws:v2from
KushagraIndurkhya:fix/s3-cp-exit-code-10743

Conversation

@KushagraIndurkhya

Copy link
Copy Markdown

Issue #: #10743

Description of changes

In DoneResultSubscriber._is_existing_object_skipped, hasattr(exception, 'response') was checked and exception.response.get('Error', {}) was accessed directly. For exceptions like ReadTimeoutError, hasattr is True but exception.response is None. This resulted in an unhandled AttributeError: 'NoneType' object has no attribute 'get' inside _on_failure before FailureResult could be queued. Consequently, files_failed remained 0 and aws s3 cp exited with 0 (success) despite the upload failure.

This change:

  1. Safely checks that exception.response and future.meta.call_args.extra_args are dictionaries before querying them.
  2. Adds unit tests in tests/unit/customizations/s3/test_results.py covering ReadTimeoutError and malformed error structures.
  3. Adds a functional test in tests/functional/s3/test_cp_command.py verifying that aws s3 cp returns exit code 1 when an upload fails with ReadTimeoutError.
  4. Adds a changelog entry at .changes/next-release/s3-cp-exit-code.json.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@KushagraIndurkhya
KushagraIndurkhya requested a review from a team as a code owner November 11, 2026 20:42

This branch has not been deployed

No deployments
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