---
title: "Respond to incidents"
description: "Runbooks for what breaks in production: webhooks that fail, arrive late or arrive twice, an erasure that stopped, a maintenance cron that fails, a rate-limit spike, credits held by a reservation, a leaked secret and a provider outage, each with what degrades and what to do."
canonical_url: "https://nuxt-backend.dev/docs/ship/operate/runbooks"
---
# Respond to incidents

> Runbooks for what breaks in production: webhooks that fail, arrive late or arrive twice, an erasure that stopped, a maintenance cron that fails, a rate-limit spike, credits held by a reservation, a leaked secret and a provider outage, each with what degrades and what to do.

Version: nuxt-backend 0.6.x · Tab: Ship · Kind: how-to · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

When something breaks in production, start here. Each runbook starts from what you see, says what degrades for the people using the app while it lasts, and ends with the steps that put it right. Most start the same way: `npx nuxt-backend doctor --prod`, then the log code in the Convex dashboard's logs ([Log codes](https://nuxt-backend.dev/docs/ship/operate/troubleshooting#log-codes)).

## Webhooks fail

**You see:** a plan that did not switch after a checkout, credits that did not arrive, email statuses stuck at `sent`; `doctor --prod` fails `billing-webhook-route` or `email-webhook-route`.

**While it lasts:** plans, features and balances keep reading from the backend's cache, so nobody loses access, but nothing new arrives until the events do. A person can pull their own entitlements on demand (`useCredits().refresh()` runs `syncEntitlements`).

1. Read the [delivery log](https://nuxt-backend.dev/docs/ship/security/webhooks#the-delivery-log) (DevTools' Backend tab, as an administrator). The outcome names the cause:

  - `missing_secret`: the route has no secret. Set `BILLING_WEBHOOK_SECRET` or `EMAIL_WEBHOOK_SECRET` on the deployment.
  - `invalid_signature`: the secret differs from the endpoint's. Copy the endpoint's current secret from the provider's dashboard and set it with `npx convex env set --prod <NAME>`; for billing, `npx nuxt-backend billing sync --env production --force` stores it for you.
  - `handler_error`: your handler or an event hook threw. The error note says where; fix it and deploy. The provider retries a `500` on its own.
  - Nothing at all: the provider sends elsewhere. Check the endpoint's URL against production's `.convex.site` origin, and that the endpoint is enabled.
2. Send what was missed again: redeliver the failed events from the provider's dashboard. [Replay a webhook delivery](https://nuxt-backend.dev/docs/ship/operate/replay) does it from the log.
3. If products changed while the webhook was down, reload them: `npx convex run --prod billing:syncProducts`.

## Webhooks arrive late or twice

**Late** needs nothing: each delivery is applied whenever it arrives, and the cache catches up. **Twice** needs nothing from the package either: a redelivery of a processed id answers `200` as a `duplicate` and runs nothing again.

A delivery whose handler failed is not a processed one: its retry runs every handler again, your [billing](https://nuxt-backend.dev/docs/build/billing/events) and [email](https://nuxt-backend.dev/docs/build/email/delivery#reacting-to-events) hooks included. Write those hooks so a second run changes nothing, keyed by the event's own id.

## An erasure stopped

**You see:** `account.erasure_failed` in the logs and in the admin console's Activity tab.

**While it lasts:** the account itself is gone and nobody can sign in to it; what one participant holds (the billing customer, the email contact, a table of yours) is still there.

1. Read the error after the log line: a provider that was down, or a source of yours that threw.
2. Fix the cause, then run `account.forget(ctx, { userId })` for the account from an internal mutation of yours: the erasure resumes at the participant it stopped at. `components.backend.account.failedErasures` lists the ones waiting.
3. A failed erasure is dropped after 30 days, so resume it before then ([When an erasure fails](https://nuxt-backend.dev/docs/build/auth/accounts/data#when-an-erasure-fails)).

## A maintenance cron fails

**You see:** `maintenance.task_failed` in the logs, and the `backend-maintenance` monitor reports an error or a missed run.

**While it lasts:** nothing visible. The hourly pass deletes what the backend no longer needs (expired sessions and codes, settled AI requests, unanswered invitations, activity past its year); a failed task leaves its rows until a pass succeeds.

1. Read the error after the line. DevTools shows it beside the task on its Overview tab, and `npx convex run --prod --component backend maintenance:status` prints each task's last pass.
2. A task that fails once passes on the next hour by itself. One that fails every hour is a bug: [report it](https://nuxt-backend.dev/docs/ship/operate/help) with the line.

## A rate-limit spike

**You see:** people refused with "Too many requests", `rate_limited` errors with the `limit` they spent.

1. Tell a launch from an attack. A deployment-wide ceiling (`emailOtpGlobal`, `invitationGlobal`, `passkeySignInGlobal`) closing on a launch day is real traffic; one address or one account spending its own bucket again and again is not.
2. For real traffic, raise the ceiling in `backend/rateLimiter.ts` and deploy ([Tune rate limits](https://nuxt-backend.dev/docs/ship/security/rate-limits)).
3. For an attack, keep the limits: they are doing their job. Turn on [bot protection](https://nuxt-backend.dev/docs/services/bot-protection) if it is off, and pause sign-ups with `pause_signups` while it lasts ([Kill switches](https://nuxt-backend.dev/docs/ship/operate/flags#kill-switches)).

## Credits held by a reservation

**You see:** a balance lower than the spends explain, or `ai.reservation_close_failed`, `ai.stream_release_unscheduled` or `ai.stream_spend_lost` in the logs.

**While it lasts:** the credits a run reserved are held until it settles or is released.

- A stream that was started and never driven holds its reservation until `streamTimeout` (five minutes by default) releases it.
- `ai.reservation_close_failed`: the spend reached the billing provider; the balance re-syncs on the next refresh.
- `ai.stream_spend_lost`: the spend never reached the provider, and the reservation was released: the person was not charged for that stream.

Repeated lines point at the billing provider: see the outage runbook below.

## A secret leaked

1. Make a new value and set it, one secret at a time. The webhook secrets and the bot-check proof secret take a `new,old` list, so nothing is refused while you move the provider or the app over ([Secret rotation](https://nuxt-backend.dev/docs/ship/security#secret-rotation)).
2. A provider token (`BILLING_ACCESS_TOKEN`, `EMAIL_API_KEY`, `AI_GATEWAY_API_KEY`): make a new one in the provider's dashboard, set it, revoke the old. Nothing is redeployed.
3. `AUTH_SECRET`: run `npx nuxt-backend env rotate AUTH_SECRET --prod --retire`. The leaked value stops at once, so everyone signs in again; without `--retire` it keeps verifying for 30 days ([Rotate secrets](https://nuxt-backend.dev/docs/ship/security/secrets)). Changed by hand, it signs everyone out and needs [the steps for the signing keys](https://nuxt-backend.dev/docs/ship/operate/troubleshooting#sessions-fail-after-changing-auth_secret-by-hand).

## A provider is down

What each outage takes away while it lasts, and what to do:

<table>
<thead>
  <tr>
    <th>
      Provider
    </th>
    
    <th>
      What degrades
    </th>
    
    <th>
      What to do
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      Billing
    </td>
    
    <td>
      Checkout, plan changes and the portal answer <code>
        unavailable
      </code>
      
       (<code>
        provider_refused
      </code>
      
      ); plans, features and balances keep reading from the cache; credit spends that cannot reach the provider are released, not charged
    </td>
    
    <td>
      Turn on <code>
        pause_checkout
      </code>
      
      , so buyers read "Purchases are paused for now" instead of an error. Turn it off when the provider's status page clears
    </td>
  </tr>
  
  <tr>
    <td>
      Email
    </td>
    
    <td>
      Sign-in codes cannot be delivered (<code>
        email.secret_failed
      </code>
      
      ), so sign-in by code fails; passkeys still sign people in. Other mail, invitations and gifts among it, may arrive late
    </td>
    
    <td>
      Put up the maintenance banner saying to sign in with a passkey. Nothing to resend: a person asks for a new code once mail flows
    </td>
  </tr>
  
  <tr>
    <td>
      AI
    </td>
    
    <td>
      Metered calls fail with <code>
        unavailable
      </code>
      
       (<code>
        provider_refused
      </code>
      
      ) and release their reservations (<code>
        ai.model_failed
      </code>
      
      )
    </td>
    
    <td>
      Turn on <code>
        pause_ai
      </code>
      
      , so the calls are refused before anything is reserved
    </td>
  </tr>
  
  <tr>
    <td>
      Bot check
    </td>
    
    <td>
      A challenge that cannot be verified is refused as <code>
        unavailable
      </code>
      
       (<code>
        protection.challenge_unavailable
      </code>
      
      )
    </td>
    
    <td>
      Usually brief; the provider's status page says
    </td>
  </tr>
  
  <tr>
    <td>
      Convex
    </td>
    
    <td>
      Everything: the app cannot reach its data
    </td>
    
    <td>
      Convex's status page; the health endpoint answers <code>
        503
      </code>
      
       and the uptime check alerts
    </td>
  </tr>
</tbody>
</table>

The kill switches and the banner are in the admin console's Flags tab, and hold from the next call on, with no deploy ([Roll out features and pause services](https://nuxt-backend.dev/docs/ship/operate/flags)).

## Related

- [Monitor production](https://nuxt-backend.dev/docs/ship/operate): where each of these shows first.
- [Troubleshooting](https://nuxt-backend.dev/docs/ship/operate/troubleshooting): fixes by symptom, and every log code.
- [Back up, restore and roll back](https://nuxt-backend.dev/docs/ship/operate/backup): when the incident is the data itself.
- [Get help](https://nuxt-backend.dev/docs/ship/operate/help): what to send when you need a hand.
- [Scheduled jobs](https://nuxt-backend.dev/docs/build/data/jobs/scheduled#the-maintenance-the-component-runs): every maintenance task, and what it deletes.


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
