- Newest
- Most votes
- Most comments
When working with expired receipt handles in Amazon SQS, you're observing different error codes between the single-operation and batch-operation APIs. This difference is expected behavior in the SQS service.
For single operations like changeMessageVisibility and deleteMessage, when a receipt handle has expired, the service returns an HTTP 400 error with the error code "InvalidParameterValue" and a message indicating the receipt handle has expired.
For batch operations like changeMessageVisibilityBatch and deleteMessageBatch, the service handles errors differently. Instead of failing the entire batch request, it returns a per-message failure with the error code "ReceiptHandleIsInvalid" and sets the "SenderFault" flag to true.
This difference in error codes is by design. The batch operations are meant to process multiple messages in a single API call, and the service provides more specific error information for each message in the batch rather than failing the entire request.
Regarding your question about the error code when a receipt handle is expired but the message still exists with a new receipt handle: The behavior would be the same as what you're already seeing. When a visibility timeout expires, the message becomes visible again in the queue with a new receipt handle. Any attempts to use the old receipt handle (whether for changing visibility or deleting) would result in the same error patterns described above - "InvalidParameterValue" for single operations and "ReceiptHandleIsInvalid" for batch operations.
This is because once a receipt handle expires, it's no longer valid for any operations, regardless of whether the message still exists in the queue or has been deleted.
Sources
ChangeMessageVisibility - Amazon Simple Queue Service
AmazonSQSBufferedAsyncClient (AWS SDK for Java - 1.12.788)
answered a year ago
Relevant content
- AWS OFFICIALUpdated 5 years ago
