# 调用SendMessage操作时发生错误（InvalidParameterValue）：一个或多个参数值无效。消息属性大小必须小于25600字节

- **ID:** `aws/sqs-message-attributes-too-large`
- **领域:** aws
- **类别:** protocol_error
- **错误码:** `InvalidParameterValue`
- **验证级别:** ai_generated
- **修复率:** 92%

## 根因

消息属性的总大小（包括键和值）超过了SQS消息的25 KB限制。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| sqs-2024 | active | — | — |
| aws-sdk-python-1.34.0 | active | — | — |

## 解决方案

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'}})
   ```
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.
   ```

## 无效尝试

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