error-reporter.js is loaded on every page of the site. It listens for two browser events:
It also intercepts console.error to capture Go WASM crash output written to stderr, which it appends to the error stack trace when the corresponding error event fires.
Each error is keyed by type + message + line number. Duplicate errors within the same page session are suppressed so a single broken loop doesn't flood the log.
Reports are sent to POST /api/client-error using navigator.sendBeacon (preferred, fires even on page unload) or fetch as a fallback. The payload includes the error type, message, source file, line/column numbers, stack trace, page URL, and user agent.
The server appends each report as a JSON line to state/client_errors.jsonl. The file is capped at 500 entries — older entries are dropped when the cap is reached. The state directory is gitignored, so error data never enters version control.
Entries are grouped by the app they came from (derived from the page URL). The root page group covers errors on the main landing page. Each entry shows the time received, error type, message, source location, and the full stack trace on demand.