# AWS.SQS.SdkException: Message size exceeds the maximum allowed (256 KB)

- **ID:** `cloud/aws-sqs-message-size-exceeded`
- **Domain:** cloud
- **Category:** resource_error
- **Error Code:** `AWS.SQS.SdkException`
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

Amazon SQS limits individual message payloads to 256 KB (including metadata); sending larger messages triggers this exception.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| AWS SDK for Python 1.32.0 | active | — | — |
| AWS SDK for Java 2.21.0 | active | — | — |
| SQS API 2012-11-05 | active | — | — |

## Workarounds

1. **Store the large payload in Amazon S3 and send the S3 object key in the SQS message. Example: upload to S3, then send JSON {'s3_bucket': 'my-bucket', 's3_key': 'path/to/payload.json'}.** (95% success)
   ```
   Store the large payload in Amazon S3 and send the S3 object key in the SQS message. Example: upload to S3, then send JSON {'s3_bucket': 'my-bucket', 's3_key': 'path/to/payload.json'}.
   ```
2. **Use the SQS Extended Client Library (Java or Python) which automatically handles S3-backed large messages.** (90% success)
   ```
   Use the SQS Extended Client Library (Java or Python) which automatically handles S3-backed large messages.
   ```
3. **Reduce the message payload by removing unnecessary metadata or using a more compact format like Protocol Buffers instead of JSON.** (75% success)
   ```
   Reduce the message payload by removing unnecessary metadata or using a more compact format like Protocol Buffers instead of JSON.
   ```

## Dead Ends

- **** — Compression is not transparent; the receiver must implement decompression, and the raw size limit still applies. (60% fail)
- **** — SQS does not guarantee order across multiple messages unless using FIFO queues with a message group ID. (80% fail)
