# An error occurred (InvalidParameterValue) when calling the SendMessage operation: Value for parameter MessageRetentionPeriod is not valid. Must be between 60 and 1209600 seconds

- **ID:** `aws/sqs-message-retention-period-exceeded`
- **Domain:** aws
- **Category:** config_error
- **Error Code:** `InvalidParameterValue`
- **Verification:** ai_generated
- **Fix Rate:** 92%

## Root Cause

The SQS queue's message retention period was set outside the allowed range (60 seconds to 14 days), causing send or update operations to fail.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Amazon SQS API 2012-11-05 | active | — | — |
| AWS SDK for Java 2.20.0 | active | — | — |

## Workarounds

1. **Set the MessageRetentionPeriod to a valid value between 60 and 1209600 seconds. For example, use the AWS CLI: 'aws sqs set-queue-attributes --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue --attributes MessageRetentionPeriod=345600' (4 days).** (95% success)
   ```
   Set the MessageRetentionPeriod to a valid value between 60 and 1209600 seconds. For example, use the AWS CLI: 'aws sqs set-queue-attributes --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue --attributes MessageRetentionPeriod=345600' (4 days).
   ```
2. **If the queue was created with an invalid retention period, delete and recreate the queue with a valid value: 'aws sqs create-queue --queue-name MyQueue --attributes MessageRetentionPeriod=86400' (1 day).** (90% success)
   ```
   If the queue was created with an invalid retention period, delete and recreate the queue with a valid value: 'aws sqs create-queue --queue-name MyQueue --attributes MessageRetentionPeriod=86400' (1 day).
   ```

## Dead Ends

- **** — Setting the retention period to exactly 60 seconds or 1209600 seconds may still fail if the queue already exists with a different value; the update might require a queue recreation. (30% fail)
- **** — Trying to set the retention period via the console without refreshing the queue attributes might use a cached, invalid value from a previous configuration. (20% fail)
