# JavaScript errors

Browser error capture, redaction, grouping, and reporting limits.

The [tracking script](https://docs.kogut.dev/web-apps/tracking-script/) reports uncaught exceptions and
unhandled promise rejections. Caught errors are not reported.

## Reported errors

- `error` supplies the message, file, line, column, and stack.
- `unhandledrejection` supplies an `Error`'s message and stack, or the rejection's text.

Cross-origin scripts without CORS expose only `Script error.`. Details require
`crossorigin="anonymous"` on the script tag and a matching CORS response header.

The server discards errors whose source or top stack frame is a `chrome-extension://`,
`moz-extension://`, `safari-extension://`, or `safari-web-extension://` URL. An error
from the site's own script is kept even when its message or a calling frame mentions an
extension.

The browser removes URL queries, fragments, and credentials, and replaces email
addresses and token-like strings. It trims messages to 500 characters, stacks to 2,000,
and sources to 300. The server redacts again and stores at most 500 bytes per message
and 2,000 per stack.

## Limits in the browser

Each page sends at most five distinct errors. An error with the same message and top
frame is sent once. A [route change](https://docs.kogut.dev/web-apps/single-page-apps/) resets the limit.

## Grouping

The server groups errors by the redacted message and the top stack frame's file path and
line, or the source and line without a stack. URLs, quoted values, and numbers in
messages do not split groups. Content hashes in bundle names, such as `app.3f9a2c1d.js`
or `index-BRhR3vqs.js`, are ignored, so a deploy does not split a group. Stored sources
and stacks keep the real file names.

Each group records its message, source, count, and first and last seen times.
Individual occurrences retain the path, browser, and redacted stack. The **JavaScript
errors** card appears in **Analytics** and on linked services. The
[MCP](https://docs.kogut.dev/reference/mcp/) `errors` tool also lists groups.

New groups create timeline events and appear in daily summaries and
[deploy reports](https://docs.kogut.dev/deploys/reports/). Retention is set in
[`[retention]`](https://docs.kogut.dev/reference/configuration/#retention).

## Error spikes

An error spike does not open an incident by itself. It can be a
[likely cause](https://docs.kogut.dev/incidents/correlation/) in a service's incident.

## Source maps

kogut stores redacted browser stacks without fetching or applying source maps.
