# scan agent crashed on webgl page with no dom fallback - how to fix it

## TL;DR

Guard the WebGL path: detect WebGL canvases up front, skip DOM auditing inside them, verify a fallback exists for non-WebGL users, and continue with the rest of the page. A page that is all WebGL with no DOM has nothing for axe to analyze. One line of why: crashing on the unanalyzable poisons the whole run, while skipping with a flagged gap keeps the audit honest.

## The error, verbatim

```text
ScanAgentError: tab crashed on WebGL page
    url: https://example.com/3d-viewer
    webgl_contexts: 2, dom_nodes: 140 (chrome shell only)

```

## Fix it step by step

### Step 1: Reproduce the crash

```bash
node agent/run-audit.js --route /3d-viewer | rg -i 'crash|webgl' | head -5
```

Expected: The tab crashes on the WebGL page.

### Step 2: Confirm no DOM fallback

```bash
curl -s https://example.com/3d-viewer | rg -c 'canvas' | head -2
```

Expected: Shows canvas elements with almost no surrounding DOM.

### Step 3: Add the WebGL guard

```bash
rg -n 'webgl|canvas' agent/scanner.js | head -10
```

Expected: Add: detect WebGL contexts, check for fallback content, skip inner audit, flag the gap.

### Step 4: Re-run the audit

```bash
node agent/run-audit.js --route /3d-viewer | tail -4
```

Expected: Agent audits the page shell, flags the WebGL gap, and completes.

### Step 5: Add a regression probe

```bash
node agent/run-audit.js --smoke | tail -3
```

Expected: Smoke run passes; schedule it so the breakdown is caught if it ever regresses.

## When to use this skill

- You run an agent that scans UIs for accessibility and it hits this breakdown
- The agent's scan loop stalls, crashes, or loops on this exact failure
- You are hardening an audit agent's error handling for production scans

## When NOT to use this skill

- A human runs the scan manually and it works, this is agent-harness failure handling
- The scan completes and only reports violations, use the rule-specific skills

## Compatibility

Scan agent harness. WebGL detection via canvas getContext in the page. Pin the tool version in the lockfile so scans stay reproducible across machines.

## Variant phrasings

### agent crash webgl page

Same crash, same guard.

### webgl no fallback audit

Practitioner phrasing for the product gap.

### the breakdown hits other routes too

Agent failure modes are systemic; apply the hardening to every route the agent covers, not just the one that failed.

## Why it happens

WebGL pages render into canvas contexts that axe cannot see into, and the GPU contexts can crash constrained agent browser tabs. Agents that treat the page like a normal DOM page either crash or loop. The guard is: detect WebGL contexts early, audit the surrounding page shell normally, check for a non-WebGL fallback (a list view, a table), and flag the 3D content as unauditable with a recommendation. The product bug (no fallback) and the agent bug (crash instead of skip) are separate findings. Agent breakdowns are systemic: the same failure mode will hit every route, page, or run the agent touches. Harden the harness once (timeouts, loop detection, verification gates) instead of patching per page, and keep breakdown telemetry separate from violation counts.

## Edge cases

- A WebGL viewer with a proper list or table fallback is accessible, verify the fallback and move on.
- GPU crashes vary by machine, the guard must be logic (detect and skip), not just more memory.
- Do not mark the page clean when the WebGL region was skipped, the report must show the gap.
- Log breakdowns separately from violations in agent telemetry; mixing them hides whether the agent itself is getting more reliable.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_7rTdBkG14mTO5vP08puOYg
