---
title: "fswa_error — Action Hook"
description: "Fires after a webhook delivery fails — covers both HTTP error responses and transport errors."
url: "https://wpwebhooks.org/docs/fswa-error/"
---

[WP Webhooks](https://wpwebhooks.org/) / [Docs](https://wpwebhooks.org/docs/) / fswa\_error

Action since v1.0.0

# fswa\_error

Fires after a webhook delivery fails — covers both HTTP error responses and transport errors.

/ Signature

```
do_action( 'fswa_error', $trigger, $url, $payload, $response, $attempt )
```

/ When it fires

Fires on every failed delivery attempt — 4xx, 5xx, and transport errors (connection refused, timeout, SSL). Fires before the retry decision is made.

/ Parameters

| Name | In | Type | Req | Description |
| --- | --- | --- | --- | --- |
| $trigger | param | string | yes | WordPress action name. |
| $url | param | string | yes | Endpoint URL. |
| $payload | param | array | yes | The payload that was sent. |
| $response | param | array|WP\_Error | yes | \`wp\_remote\_post()\` response or a \`WP\_Error\` for transport failures. |
| $attempt | param | int | — | Current attempt number (1-based). |

/ Examples

Alert on permanently failed deliveries

```
add_action( 'fswa_error', function ( $trigger, $url, $payload, $response, $attempt ) {
    if ( is_wp_error( $response ) ) {
        $message = $response->get_error_message();
    } else {
        $code    = wp_remote_retrieve_response_code( $response );
        $message = "HTTP {$code}";
    }
    error_log( "[fswa] Failed attempt {$attempt}: {$trigger} → {$url} ({$message})" );
}, 10, 5 );
```

/ Related

[fswa\_success](https://wpwebhooks.org/docs/fswa-success/)[fswa\_webhook\_response](https://wpwebhooks.org/docs/fswa-webhook-response/)[Smart Retry with Exponential Backoff](https://wpwebhooks.org/docs/smart-retry/)

/Ready

## Your next automation is  
one sentence away.

[Install Plugin→](https://wordpress.org/plugins/flowsystems-webhook-actions/) [See the Plugin →](https://wpwebhooks.org/wordpress-webhook-plugin/)

$ wp plugin install flowsystems-webhook-actions --activate

## Structured data

```json
{"@context":"https://schema.org","@type":"TechArticle","name":"fswa_error — Action Hook — Webhook Actions Docs","description":"Fires after a webhook delivery fails — covers both HTTP error responses and transport errors.","url":"https://wpwebhooks.org/docs/fswa-error/","isPartOf":{"@type":"WebSite","name":"WP Webhooks","url":"https://wpwebhooks.org"},"about":{"@type":"SoftwareApplication","name":"Webhook Actions","applicationCategory":"WordPress Plugin"}}
```
