---
title: "Incident runbooks"
url: "https://preview-docs.dshuniverse.com/en/ops/runbooks/"
lang: "en"
updated: "2026-11-17"
license: "CC-BY-4.0"
licenseScope: "DSH Universe plugin data"
---

# Incident runbooks

## Sync has stopped

Compare the latest System status entry with pipeline logs. Check the Cron trigger, GitHub App installation and rate limits, and npm registry reachability. Rotate a credential when it has expired or leaked. Confirm the next scheduled sync succeeds. See [secrets](/en/ops/secrets/).

## Scan jobs reach the dead-letter queue

Find the affected version in pipeline logs and the admin dead-letter list. Fix the download, unpacking, or scan failure before an authorized operator redrives the job. Verify the audit entry, scan completion, and projected tier.

## Rescan the catalog in bulk

After deploying new scan rules, submit `pnpm --filter @dshu/scripts rescan-all --env preview`. Add `--limit 10` for a bounded rehearsal. API pages through versions by ID and dispatches batches of at most 100 with at least one second between batches. It records the cursor and resumes from the last confirmed dispatch after a failure. Use `--version-id "$VERSION_ID"` to rescan one exact version ID from the admin console.

To target multiple versions, use `--version-list ./versions.txt`. Provide one version ID per line in a UTF-8 file of up to 200 lines and 16 KiB. The audit entry records the target list. The status field `sent` counts the jobs dispatched. Withdrawn or unavailable versions are skipped.

On Preview, add `--large-archive` to the list command to retry current catalog versions whose latest scan skipped them for archive size or file count. A separate queue processes one job at a time. Manual retries allow up to 64 MiB of compressed data and 128 MiB of decompressed data. Versions previously skipped for file count may scan up to 8,000 files. Redrives use the same queue.

Each Preview sync automatically retries up to 40 current versions whose discovery scan exceeded the archive limit. These retries use the same dedicated queue with a 12 MiB compressed archive limit. Check `sync_runs.stats.archiveRetries` for the number dispatched. If an automatic retry still exceeds the limit, use the targeted manual command above.

For `too_large` reports, check the optional `stats.sizeLimit` field. Its `kind` distinguishes the advertised size, compressed stream, decompressed stream, and package manifest. `limitBytes` and `observedBytes` record the threshold and the value that crossed it. A larger archive cap does not change the individual manifest limit.

When updating the large archive consumer, apply Preview database migrations and run `pnpm --filter @dshu/pipeline exec wrangler deploy --config wrangler.large-preview.jsonc` before publishing the regular Preview pipeline and API.

Run `pnpm --filter @dshu/scripts rescan-all --env preview --status --request-id "$REQUEST_ID"` to inspect a request. `sent` and `completedAt` report queue dispatch progress. The pipeline and projector handle scanning and tier updates separately.

## The index is stale

1. Compare both index responses and their ETags on the API and web origins. Confirm the environment.
2. Check API logs for `index.rebuild_failed` and projection errors and verify the D1 tier and moderation decision.
3. After fixing the underlying problem, observe scheduled projection and index recovery and request the indexes again. To request a rebuild on the next scheduled tick, run `pnpm --filter @dshu/scripts rebuild-index --env preview`. Add `--status` to check completion.

## Reproject after a rule change

After deploying new tier or discovery rules, run `pnpm --filter @dshu/scripts reproject --env preview`. The command resets the catalog cursor so scheduled API runs can reprocess the catalog in batches. Add `--status` to see whether the latest request is pending and read its watermark. Each request returns an ID and writes an audit entry. The worker coalesces requests of the same kind and reports the latest one.

## Admin sign-in fails

Check the Cloudflare Access policy, JWT team domain and audience, and OAuth callback against API’s `ADMIN_ORIGIN`. Then verify the signed-in account’s role. To initialize the first owner in Preview, run `pnpm --filter @dshu/scripts init-owner --github-login "$GITHUB_LOGIN" --env preview`. Use the account recovery procedure if an owner is already configured.

## Urgent plugin takedown

Use the admin moderation action when it is available and record the reason. The fallback command for Preview is:

```bash
pnpm --filter @dshu/scripts emergency-takedown --plugin-id "$PLUGIN_ID" --reason "$REASON" --env preview
```

The script targets `local`, `preview`, or `prod`. Confirm the target, record the returned `reviewId`, and verify the plugin page and both indexes. Keep the audit record and contact the upstream platform where appropriate.

### Fixed Preview fixture drill

After the branch passes full CI, select `preview` and enable `emergency_drill` in the deployment workflow. After deploying, it runs the actual emergency CLI against `@dshuniverse/preview-fixture`. Starting before the CLI invocation, it requires all four API/Web curated/full index endpoints to exclude the fixture within 60 seconds and checks the removal page. Preflight requires the owned fixture to be present with no active takedown.

The restore step runs even if the drill fails. It only restores this run’s latest takedown and atomically checks its review ID when writing both the audit and decision, preserving any intervening operator action. It then verifies the fixture’s original content in all four endpoints and both audit entries. Reports and hash manifests stay on the runner at `~/.local/share/dshuniverse-ci-reports/<run>-<attempt>/deploy/`. This drill does not establish admin login or the manual moderation scenario. Live results are still pending.
