# Failure handling

> Learn how Triggers handles errors and retries for Cloud Code and webhook actions, and when events enter the dead letter queue.

Both Cloud Code and webhook actions can produce failed events. These events are retried and, if all retry attempts are exhausted, might be moved to the dead letter queue. Refer to [Dead letter queue](/triggers/tutorials/manage-dlq/dead-letter-queue.md) for event statuses and management options.

## Cloud Code actions

If the invoked Cloud Code script or module returns an error response, the action is not retried.

If an internal problem occurs during execution (for example a timeout or service failure), the Triggers service retries the execution. After retries are exhausted, the event can be added to the dead letter queue.

To monitor and debug the execution of your triggers, use [Logging](/cloud-code/logging/overview.md).

## Webhook actions

When a trigger uses a webhook action, the Triggers service sends an HTTP request to your configured URL. The service makes up to 3 application-level retries using exponential backoff, starting at 1 second and capping at 30 seconds per interval. If all retries fail, the event is added to the [dead letter queue](/triggers/tutorials/manage-dlq/dead-letter-queue.md).

The following table describes which responses are retried.

| Response                       | Retried | Notes                                                                                                                                  |
| ------------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| 5xx server errors              | Yes     | For example 500, 502, 503, 504.                                                                                                        |
| 429 Too Many Requests          | Yes     | The service honors the `Retry-After` response header on 429 and 503 responses when it contains an integer number of seconds.           |
| Timeouts and network errors    | Yes     |                                                                                                                                        |
| 4xx client errors (except 429) | No      | For example 400, 401, 403, 404. Not added to the dead letter queue. Fix the webhook configuration or endpoint and trigger a new event. |

## Additional resources

* [Dead letter queue](/triggers/tutorials/manage-dlq/dead-letter-queue.md)
* [Webhooks](/triggers/webhooks.md)
* [Limits](/triggers/limits.md)
* [Manage the dead letter queue in the Unity Dashboard](/triggers/tutorials/manage-dlq/unity-dashboard.md)
* [Manage the dead letter queue with the CLI](/triggers/tutorials/manage-dlq/cli.md)
* [Manage the dead letter queue with the REST API](/triggers/tutorials/manage-dlq/rest-api.md)
