SNS Error Codes: Common Causes and How to Fix Them
In this article
Most Amazon SNS error codes mean one of three things: your credentials or permissions are wrong, the endpoint you are publishing to is bad, or you have hit a service limit. Match the exact code to its cause below, then apply the matching fix.
Time 10 min · Steps 7 · Level Medium
How to Read and Fix an SNS Error Code
- Copy the exact code and message. SNS returns a code (such as InvalidParameter, AuthorizationError or Throttling) plus a message string. The message, not just the code, usually tells you which field or resource failed.
- Check the HTTP status. A 4xx status means the request itself was wrong (bad parameters, missing permission). A 5xx or Throttling code means retry after waiting, since the service was busy or a limit was hit.
- Validate the topic or endpoint ARN. An ARN looks like arn:aws:sns:region:account-id:topic-name. A typo in the region, account ID or topic name produces InvalidParameter or NotFound errors.
- Verify IAM permissions. The caller needs sns:Publish for the topic, plus sns:Subscribe if you are adding subscribers. Missing permissions surface as AuthorizationError or AccessDenied.
- Confirm the endpoint format. Email and SMS endpoints must be valid and, for email, confirmed through the subscription link before messages will be delivered.
- Apply exponential backoff on retry. For Throttling or internal-error codes, wait a short interval, double it on each failure, and cap the number of retries rather than retrying in a tight loop.
- Enable delivery status logging. In the SNS console, set the delivery status logging for the protocol you use (labels can differ slightly by version). The CloudWatch logs then show per-endpoint failure reasons instead of a generic code.
What Each Common SNS Error Code Means
Start with the code itself, because each one points at a different layer of the request. The table below maps the codes you are most likely to see to their usual cause and fix.
| Symptom / code | Likely cause | Fix |
|---|---|---|
| InvalidParameter | Malformed ARN, bad phone number format, or an unsupported message attribute | Re-check the ARN spelling and the parameter format required for the protocol |
| AuthorizationError / AccessDenied | IAM policy missing sns:Publish or sns:Subscribe on that topic | Add the action and the correct resource ARN to the policy of the caller |
| NotFound | Topic or subscription ARN does not exist in that region and account | Confirm the topic exists in the same region your client is configured for |
| Throttling / RequestLimitExceeded | Too many requests per second for your account | Retry with exponential backoff and spread publishes across topics |
| EndpointDisabled (mobile push) | The device token was invalidated by the platform (app deleted or token expired) | Re-register the token with the platform, then update or delete the SNS endpoint |
| InvalidClientTokenId | Expired or wrong access key in your credentials | Rotate or correct the access key pair used by your client or CLI |
Confirming the cause before you change anything
Run the same publish with the AWS CLI using aws sns publish --topic-arn ... --message "test" from the same machine and credentials as your application. If the CLI succeeds, the problem is in your application code or its credentials, not SNS itself. If the CLI fails too, the error message printed there is the most reliable diagnosis you will get, and you can take the fix straight from the table above.
Quick Checks Before Deeper Debugging
Work down this list in order; it catches most SNS errors in a few minutes.
- Is the region in your client configuration the same region as the topic ARN?
- Does the account ID in the ARN match the account you are signed in to?
- Is the topic name spelled exactly, including capitalisation and any suffix such as a filter or FIFO ".fifo" name?
- Are the credentials you are using active (not expired or deleted) in IAM?
- For email endpoints, has the subscriber clicked the confirmation link? Unconfirmed subscriptions accept the publish but deliver nothing.
- For SMS, is the destination number in E.164 format (a plus sign followed by the country code and number)?
- For mobile push, is the platform application's server credential (the token or key from the push service) still valid?
Why SNS Errors Happen and How to Stop Them Returning
Most repeat SNS errors come from one of four habits, and each has a durable fix.
Hard-coded ARNs and credentials
A topic ARN pasted into code breaks the moment the account, region or topic name changes, and hard-coded keys expire silently. Confirm by checking whether the error appeared after a deployment or an environment change. The fix is to pass the ARN through configuration and to use short-lived roles or environment-based credentials instead of a fixed key pair.
Region mismatch
SNS topics are regional: a topic created in one region is invisible from a client pointed at another, and the resulting NotFound or InvalidParameter error does not say why. Confirm by comparing the region name in your client config against the region inside the ARN string. The fix is to set the client region from the ARN itself, or keep both in the same configuration value.
Unconfirmed or dead endpoints
A publish call can succeed while nothing is delivered, because the subscription is pending or the mobile token is dead. Confirm by turning on delivery status logging and reading the per-endpoint result in CloudWatch Logs. The fix is to clean up: delete endpoints that report as disabled after re-registration fails, and prune subscriptions that never confirm.
Retry storms
When a Throttling error triggers an immediate retry, the retries themselves keep the throttle active. Confirm by looking for many Throttling errors within the same second in your logs. The fix is exponential backoff with a cap, plus jitter, so retries spread out instead of arriving together.
Message size and attribute limits
SNS messages have a size limit measured in bytes, and message attributes have their own limit; oversized messages return an error on publish. Confirm by checking the byte length of your payload, not the character count, since multi-byte characters count more. The fix is to send a short notification and put the full content in storage (such as S3) that the subscriber fetches, which is the standard pattern for large payloads.
When the Error Is Not Yours
Some codes, including internal-error responses and brief Throttling bursts, resolve on their own. If the AWS health dashboard shows an ongoing service event in your region, and your code and permissions have not changed, waiting and retrying with backoff is the correct action rather than reworking working code. If everything above checks out and the error persists, capture the request ID from the error response; AWS support can trace a specific request by that ID, which is far faster than describing the problem generally.
Official source: AWS Documentation