Quick answer: Catch the exception on every write, shrink what you store (compress, prune), and move large data to IndexedDB, which has far larger quotas.

localStorage is a small string bucket, and games outgrow it with replays, histories, and hoarded state. The error is synchronous and catchable — and the real fix is storage strategy. Here it is.

How to fix it

1. Wrap writes in try/catch

Every setItem can throw (quota, private modes, disabled storage) — a save helper that catches, reports, and falls back keeps a full quota from becoming a crash loop.

2. Store less

Prune histories, cap logs, and compress JSON (even simple LZ-string) — most oversized saves are unbounded accumulation, not necessary data.

3. Graduate to IndexedDB

Replays, images, and big blobs belong in IndexedDB (async, structured, generous quotas) — keep localStorage for small flags and settings.

4. Mind shared origins

On portals hosting many games under one domain, the quota is shared across all of them — prefix your keys and assume neighbors may have filled the bucket; degrade gracefully.

Catching the ones you can't reproduce

The hardest version of this to fix is the one you can't reproduce — it only happens on a player's hardware, OS, driver, or save state, under conditions that simply aren't present on your machine. A report that says “it crashed” or “it froze” gives you nothing to act on, so the bug survives release after release while quietly costing you players.

Automatic error capture closes that gap. Each failure arrives with its full stack trace, the device and OS, the build number, and a breadcrumb trail of what the player did right before it broke, so even a failure you have never seen becomes a specific, reproducible issue. Fold identical failures into one signature ranked by how many players each hits, and your worklist sorts itself worst-first instead of arriving as a stream of vague complaints.

This is where a tool like Bugnet earns its place. Its SDK captures every HTML5 error automatically with the full stack trace plus device, OS, memory, build, and game-state context, folds duplicates into one grouped issue with an occurrence count, and ties each to the build it first appeared on — so you fix the problem that hurts the most players first and confirm it is gone when its signature disappears from the next release.

The errors you never hear about are the ones quietly costing you players. Visibility turns them into a worklist.