---
name: Browser Error Snapshot
slug: browser-error-snapshot
category: Quality
description: "Captures screenshot and element snapshot on browser errors during e2e testing, saving to gitignored .ai/scratch/e2e/. Invoke when 'Something went wrong', auth errors, blank pages, or unexpected redirects appear. A building block that captures and returns, leaving further action to the caller."
github: "https://github.com/crbnos/carbon/tree/main/.ai/skills/error"
language: TypeScript
stars: 2272
forks: 318
install: "git clone https://github.com/crbnos/carbon"
added: 2026-07-20T06:48:06.963Z
last_synced: 2026-07-20T06:48:06.963Z
canonical_url: "https://dirskills.com/skills/browser-error-snapshot"
---

# Browser Error Snapshot

Captures screenshot and element snapshot on browser errors during e2e testing, saving to gitignored .ai/scratch/e2e/. Invoke when 'Something went wrong', auth errors, blank pages, or unexpected redirects appear. A building block that captures and returns, leaving further action to the caller.

**Install:** `git clone https://github.com/crbnos/carbon`

## README

# error — capture browser failure diagnostics

Capture artifacts when the browser shows a failure, then hand control back to
the calling skill. Never stops the calling run by itself.

## When to invoke

Any `agent-browser snapshot` that reveals:

- a "Something went wrong" heading
- "Authentication Error" or similar
- a blank page or unexpected redirect
- any content indicating the page failed to render

## Steps

### 1. Resolve the slug

Use `CARBON_WORKTREE` from `.env.local` if present; otherwise the current
branch name:

```bash
SLUG=$(grep '^CARBON_WORKTREE' .env.local | cut -d= -f2)
[ -z "$SLUG" ] && SLUG=$(git branch --show-current | tr '/' '-')
```

### 2. Capture both artifacts

Save to `.ai/scratch/e2e/` — it is gitignored (`.ai/scratch/` in `.gitignore`).
Never save captures under `docs/` (that's the documentation app, and it is
tracked).

```bash
mkdir -p .ai/scratch/e2e/${SLUG}
STAMP=$(date +%Y%m%d-%H%M%S)
agent-browser screenshot .ai/scratch/e2e/${SLUG}/${module}-${STAMP}.png
agent-browser snapshot -i > .ai/scratch/e2e/${SLUG}/${module}-${STAMP}.txt
```

`${module}` = a short name for the route/feature under test (e.g. `accounting`).
The `.txt` snapshot lets you debug element structure without reopening a browser.

### 3. Report and return

Log both file paths and **continue** — the caller decides whether to abort.
Include the paths in the caller's final report so a human can open them.

## Output

- `.ai/scratch/e2e/{slug}/{module}-{timestamp}.png` — screenshot
- `.ai/scratch/e2e/{slug}/{module}-{timestamp}.txt` — element snapshot
