---
title: Error Alerts
description: When GOCSM disables a snippet after an error, it can tell you straight away by email, by a signed webhook, or both. A disabled snippet stops running until someone activates it again, so a snippet behind a REST route, a…
url: "https://brightleafdigital.io/docs/error-alerts/"
updated: "2026-11-10"
category: GravityOps Code Snippet Manager / Advanced
---

# Error Alerts

When GOCSM disables a snippet after an error, it can tell you straight away by email, by a signed webhook, or both. A disabled snippet stops running until someone activates it again, so a snippet behind a REST route, a cron job or a form hook can otherwise stay off for hours before anyone notices.

An alert is sent each time a snippet moves to **Error**:

- a PHP fatal error, or an exception thrown while the snippet loads
- a generated file that is missing or fails its integrity check
- a failed activation, such as a syntax error or an unmet requirement

## Setting it up

Go to **Settings** and find **Error alerts**.

| Option | Default | What it does |
| --- | --- | --- |
| Send an email | On | Emails the recipients below. |
| Email recipients | Empty | One address per line. When empty, the email goes to the site's administration email address (**Settings → General**). |
| Webhook URL | Empty | Posts a signed `snippet_error` event to this URL. Leave empty to post nothing. |
| Signing secret | Empty | Signs each webhook request. The field stays blank after saving; leave it blank to keep the saved secret. Nothing is posted until both a URL and a secret are saved. |

The webhook is separate from [change notifications](https://brightleafdigital.io/docs/change-notifications/), with its own URL and secret, so alerts can go to an on-call channel while code changes go to a review queue.

## Multisite

On a multisite network, a network administrator can set **Applies to** to **Every site in this network** on the main site's Settings tab. Those recipients and that webhook then receive alerts from every site in the network, including sites added later. Each site's own settings still apply as well, so by default each site also emails its own administrator. A site webhook with the same URL as the network webhook is skipped, so the endpoint does not receive each alert twice.

Choosing one scope on the main site resets the other to its defaults.

## The webhook request

Each alert is a `POST` with a JSON body:

```
{
  "event": "snippet_error",
  "occurred_at": "2026-11-09T17:43:04+00:00",
  "origin": "render",
  "site": { "id": 1, "name": "Example Site", "url": "https://example.com/", "network_url": "https://example.com/" },
  "snippet": {
    "id": 56,
    "name": "REST bridge",
    "type": "php",
    "status": "error",
    "previous_status": "active",
    "error_message": "Generated file hash mismatch: ...",
    "error_count": 1,
    "collection_id": 0,
    "version": null,
    "created": {
      "at": "2026-11-09T16:41:32+00:00",
      "origin": "created",
      "user": { "id": 7, "login": "jane", "email": "jane@example.com", "display_name": "Jane" }
    },
    "last_changed": {
      "at": "2026-11-09T17:43:03+00:00",
      "origin": "save",
      "user": { "id": 9, "login": "sam", "email": "sam@example.com", "display_name": "Sam" }
    },
    "edit_url": "https://example.com/wp-admin/admin.php?page=..."
  }
}
```

`origin` says where the snippet failed: `fatal`, `execution`, `render` or `activate`. `created` and `last_changed` come from the snippet's revision history, so they show who wrote the code and who changed it last, and when. `last_changed.origin` is how that revision was made, such as `save`, `update` or `restore`. `user` is `null` for a change made without a signed-in user, such as a scheduled update, and both entries are `null` for a snippet with no revisions. The snippet's code is never included; follow `edit_url` to read it.

The email carries the same details.

The headers, signature, verification and retries work the same way as for change notifications, with `X-GOCSM-Event` set to `snippet_error`. See [Change Notifications](https://brightleafdigital.io/docs/change-notifications/#verifying-a-request).

## The admin notice

Each snippet in **Error** is also listed in an admin notice for users who can manage snippets. The notice stays on every admin page until the snippet is activated, deactivated or deleted.

## Other channels

To send alerts somewhere else, such as Slack or a paging service, listen to `gocsm_snippet_status_changed` and act when the new status is `error`. It fires on every path into Error:

```
add_action( 'gocsm_snippet_status_changed', function ( $id, $status, $old_status, $origin, $snippet ) {
    if ( 'error' !== $status ) {
        return;
    }
    // $snippet->name, $snippet->error_message, $origin ...
}, 10, 5 );
```

`gocsm_error_alert_payload`, `gocsm_error_alert_recipients` and `gocsm_error_alert_email` change or suppress the built-in alerts. See [Actions and filters](https://brightleafdigital.io/docs/actions-and-filters/).

## Checking snippet health through the API

With Premium or Agency, the [Abilities API](https://brightleafdigital.io/docs/abilities-api/) reports errors without opening wp-admin. `gocsm/get-status` lists every snippet in error on the site with its message. `gocsm/list-snippets` filters by `status: error`. `gocsm/get-snippet` returns one snippet's status and error message.

## Stuck? Ask in GravityOps Help

Search past answers or post your question, tagged "snippet-manager".

- [GravityOps Code Snippet Manager: the snippet is active but nothing happens](https://brightleafdigital.io/community/gravityops-help/4148/)GravityOps Help - 0 replies - 6 days ago

[Ask in GravityOps Help](https://brightleafdigital.io/community/gravityops-help/?gofrm_tag=snippet-manager)[Open a support request](https://brightleafdigital.io/support/)

GravityOps Weekly

[This iframe contains the logic required to handle Ajax powered Gravity Forms.](about:blank)
