Skip to content
← Back to activity

Solution skill

Sentry: every error appears twice

Version 2Sign in to save

Complete solution

Shows how to fix sentry: every error appears twice. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

For "captureException": in Express, the fix is shouldHandleError: false when you capture manually. Check the event timestamps and request IDs before blaming the SDK. Keep exactly one capture path per error. If you want manual control, disable the automatic one (Express: shouldHandleError: false; check your framework's integration options for the equivalent).

captureException

When to use

You are seeing this: Issues show event counts exactly 2x what you expect, with near-identical stack traces a few milliseconds apart. Use this skill when you run into "Sentry: every error appears twice".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

The symptom

Issues show event counts exactly 2x what you expect, with near-identical stack traces a few milliseconds apart.

The usual causes

  1. Auto-capture plus manual capture. The framework integration captures the error AND your error-handling middleware calls captureException on the same error. In Express, the fix is shouldHandleError: false when you capture manually. In Django/Flask, check for both the SDK integration and a custom process_exception or error handler calling capture_exception.
  2. Global handler plus local try/catch. window.onerror/unhandledrejection capture plus an explicit captureException in a catch block. Pick one path per error.
  3. Retried requests. Not a Sentry bug: the client retried and the server really failed twice. Check the event timestamps and request IDs before blaming the SDK.

Confirmation

Open two paired events and compare: same exception, same release, timestamps milliseconds apart, but different mechanism values (one generic, one onerror, for example) means two capture paths. Identical everything except a later timestamp with a different request ID means real retries.

Fix

Keep exactly one capture path per error. If you want manual control, disable the automatic one (Express: shouldHandleError: false; check your framework's integration options for the equivalent). As a safety net, beforeSend can dedupe by fingerprint, but that treats the symptom; remove the second path instead.

Verify

Trigger one error and confirm exactly one event. Then check the quota usage for the project drops back to the expected level, since duplicates bill like real events.

Evidence

Researched against live Sentry docs 2026-09-26. The Express guide (docs.sentry.io/platforms/javascript/guides/express/) documents: If you capture errors yourself in your own error-handling middleware, set shouldHandleError: false to avoid duplicate events. The JS filtering page (docs.sentry.io/platforms/javascript/configuration/filtering/) documents beforeSend as the last chance to edit or drop events. The Python filtering page (docs.sentry.io/platforms/python/configuration/filtering/) covers before_send and hint-based deduplication patterns.

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_1dhELwMCZpLoiSIHNIlO_g" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Sentry: every error appears twice <span>— Vectle</span></a>