You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Wrong response code from failed precondition If-None-Match #6023
When submitting a write to an object in S3 with the If-None-Match header set in the SDK, a 200 response code can occasionally be returned along with the expected Exception, rather than the expected 412 response code.
Regression Issue
Select this option if this issue appears to be a regression.
Expected Behavior
I expect to see a 412 response code every time this pre-condition is not met. The flakiness of the response code makes handling the return more cumbersome.
Current Behavior
This is a possible Exception/response payload that can be returned on failing the pre-condition: software.amazon.awssdk.services.s3.model.S3Exception: At least one of the pre-conditions you specified did not hold (Service: S3, Status Code: 200, Request ID: 9YD49V2HRSDRS8K1, Extended Request ID: jUpbn2VaLT6Kwi6vyaN32y1OOWX0ShIocGfV+9+I7qG7kmmAR7kVCA3WATwcjpDMPdTEg3hLPuI=)
Reproduction Steps
The issue happens intermittently on the S3 side and it is not clear how to reproduce.
Reproduction Steps
The issue happens intermittently on the S3 side and it is not clear how to reproduce.
Understood. Can you provide a code snippet showing the s3 client and the GetObject request call, so I can try to reproduce the same conditions?
This is on upload, not download. The example I was looking at was on a multipart upload during one of the upload part calls: val uploadPartRequest = UploadPartRequest.builder() .bucket(bucket) .key(key) .uploadId(uploadId) .partNumber(partNumber) .contentMD5(chunkMd5) .contentLength(chunk.length) val body = AsyncRequestBody.fromBytesUnsafe(chunk) client.uploadPart(uploadPartRequest.build(), body)
@bbraatCrwdsorry, you're right, if-none-match makes no sense with read operations. Edit: actually if-match and if-none-match can be provided in GetObject calls, don't know why I was confused.
I'm wondering if this is a s3 server-side issue - the SDK usually don't modify a response status code, according to the exception you pasted it looks like the 200 was sent by s3, the SDK is only unmarshalling the response. Maybe some edge case of what is described in the multipart upload scenario here.
One way to confirm this is to generate the verbose wirelogs and get the actual response at the error moment (instructions for the verbose wirelogs can be found in our Dev Guide); the other is to reach out to the s3 team with your request ID (you'll need to provide a more recent one) and ask them to investigate. Let us know what you think.
Marking this to autoclose soon. If you get a request ID or the verbose wirelogs, please send to us and we can take a look.
We see:
oftware.amazon.awssdk.services.s3.model.S3Exception: At least one of the pre-conditions you specified did not hold (Service: S3, Status Code: 200, Request ID: T4XW17Q58VE3JCHY, Extended Request ID: Ao2mjr9NiCtlLpA1zKgKdVGNYst7E44NBEUzNYikTXUY7ViOEMSiLe3jCy+WM+WpiYIcww0j3rz6CUA+fRC80g==) (SDK Attempt Count: 1)
---- cut here ---8<--------8<--------8<--------8<--- cut here ----
java.io.IOException: Could not upload '<REDACTED BLOB KEY>` in region 'us-west-2': software.amazon.awssdk.services.s3.model.S3Exception: At least one of the pre-conditions you specified did not hold (Service: S3, Status Code: 200, Request ID: T4XW17Q58VE3JCHY, Extended Request ID: Ao2mjr9NiCtlLpA1zKgKdVGNYst7E44NBEUzNYikTXUY7ViOEMSiLe3jCy+WM+WpiYIcww0j3rz6CUA+fRC80g==) (SDK Attempt Count: 1)
Activity
debora-ito commentedon Apr 11, 2025
Understood. Can you provide a code snippet showing the s3 client and the GetObject request call, so I can try to reproduce the same conditions?
steveloughran commentedon Apr 16, 2025
so it is an exception being triggered -but the status code is 200?
odd
bbraatCrwd commentedon Apr 16, 2025
This is on upload, not download. The example I was looking at was on a multipart upload during one of the upload part calls:
val uploadPartRequest = UploadPartRequest.builder() .bucket(bucket) .key(key) .uploadId(uploadId) .partNumber(partNumber) .contentMD5(chunkMd5) .contentLength(chunk.length) val body = AsyncRequestBody.fromBytesUnsafe(chunk) client.uploadPart(uploadPartRequest.build(), body)bbraatCrwd commentedon Apr 16, 2025
That is correct, we receive it like any other exception, but the status code is a 200 instead of the expected 412
debora-ito commentedon Apr 17, 2025
@bbraatCrwd
sorry, you're right,if-none-matchmakes no sense with read operations.Edit: actually
if-matchandif-none-matchcan be provided in GetObject calls, don't know why I was confused.I'm wondering if this is a s3 server-side issue - the SDK usually don't modify a response status code, according to the exception you pasted it looks like the 200 was sent by s3, the SDK is only unmarshalling the response. Maybe some edge case of what is described in the multipart upload scenario here.
One way to confirm this is to generate the verbose wirelogs and get the actual response at the error moment (instructions for the verbose wirelogs can be found in our Dev Guide); the other is to reach out to the s3 team with your request ID (you'll need to provide a more recent one) and ask them to investigate. Let us know what you think.
debora-ito commentedon May 14, 2025
@bbraatCrwd I tried to reproduce locally, calling CompleteMultipartUpload with
if-none-matchin loop, but I got status code 412 every time.Marking this to autoclose soon. If you get a request ID or the verbose wirelogs, please send to us and we can take a look.
debora-ito commentedon May 28, 2025
@bbraatCrwd I recently found this re:Post where it confirms S3 might return 200 with errors for CompleteMultipartUpload, CopyObject and UploadPartCopy API calls - https://repost.aws/knowledge-center/s3-resolve-200-internalerror
rogerhu commentedon Jun 23, 2026
We see: