Skip to content

fix(sentry): stop reporting expected notFound/redirect as errors - #1310

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/sentry-control-flow-errors
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/sentry-control-flow-errors

Conversation

@sentry

@sentry sentry Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

This PR addresses the issue of Sentry reporting expected TanStack Start control-flow signals (notFound() and redirect()) as unhandled errors.

Problem:
TanStack Start uses throw { isNotFound: true } and throw { isRedirect: true } as control-flow mechanisms to signal 404 states and redirects. Sentry's server-side middleware captures these thrown objects as genuine errors before the application code (e.g., loadDocs's catch block) can handle them. This results in a high volume of false positive error reports in Sentry, obscuring actual issues.

Solution:

  1. src/utils/sentry-redaction.ts:
    • Introduced isRouterControlFlow(value) to detect objects with isNotFound: true or isRedirect: true.
    • Created filterSentryEvent(event, hint) which returns null (to drop the event) if hint.originalException is a router control-flow object, otherwise it calls redactByokRequestHeaders(event).
  2. src/instrument.server.mjs:
    • Updated the Sentry beforeSend configuration to use the new filterSentryEvent.
  3. src/router.tsx:
    • Modified the client-side Sentry beforeSend to also check for isRouterControlFlow(hint?.originalException) and return null early for these events, while preserving existing redaction and ad-tech filtering logic.

This change ensures that Sentry only reports actual errors, improving the signal-to-noise ratio in our error monitoring.

Fixes TANSTACK-COM-4QS

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@sentry
sentry Bot requested a review from a team September 30, 2026 11:01
@coderabbitai

coderabbitai Bot commented Sep 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 91a0f86f-9206-43e6-8fdd-17518e6e94fa

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
tanstack-com 93b361f Commit Preview URL

Branch Preview URL
Sep 30 2026, 11:04 AM

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants