# An error occurred (InvalidParameterValue) when calling the SendMessage operation: One or more parameter values are invalid. Message attributes size must be smaller than 25600 bytes

- **ID:** `aws/sqs-message-attributes-too-large`
- **Domain:** aws
- **Category:** protocol_error
- **Error Code:** `InvalidParameterValue`
- **Verification:** ai_generated
- **Fix Rate:** 92%

## Root Cause

The total size of message attributes (including keys and values) exceeds the 25 KB limit for SQS messages.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| sqs-2024 | active | — | — |
| aws-sdk-python-1.34.0 | active | — | — |

## Workarounds

1. **Move large attributes (e.g., binary data, large strings) to the message body instead. The body has a 256 KB limit. Example: sqs_client.send_message(QueueUrl=queue_url, MessageBody=json.dumps({'data': large_data}), MessageAttributes={'attr1': {'DataType': 'String', 'StringValue': 'small_value'}})** (95% success)
   ```
   Move large attributes (e.g., binary data, large strings) to the message body instead. The body has a 256 KB limit. Example: sqs_client.send_message(QueueUrl=queue_url, MessageBody=json.dumps({'data': large_data}), MessageAttributes={'attr1': {'DataType': 'String', 'StringValue': 'small_value'}})
   ```
2. **If attributes are necessary, store large attribute values in S3 or DynamoDB and pass only a reference (e.g., S3 key) as the attribute value.** (90% success)
   ```
   If attributes are necessary, store large attribute values in S3 or DynamoDB and pass only a reference (e.g., S3 key) as the attribute value.
   ```

## Dead Ends

- **** — SQS检查的是未压缩的属性大小，压缩不会改变原始大小。 (90% fail)
- **** — FIFO队列与标准队列具有相同的属性大小限制。 (100% fail)
