Skip to content

Skip benign 404 control-flow defects in error tracking - #5

Draft
posthog-eu[bot] wants to merge 1 commit into
masterfrom
posthog-code/skip-benign-404-error-noise
Draft

posthog-eu[bot] wants to merge 1 commit into
masterfrom
posthog-code/skip-benign-404-error-noise

Conversation

@posthog-eu

@posthog-eu posthog-eu Bot commented Jun 24, 2026

Copy link
Copy Markdown

Why

Error tracking for the API was being flooded with non-errors, drowning out real issues and burning triage time. Internet vulnerability scanners constantly probe non-existent routes (/.env, /.git/config, /laravel/.env, /admin/*, etc.), and the global capture hook in observability.ts was forwarding every resulting 404 defect to PostHog. This produced two high-volume false-positive issues — CapturedNonError (Effect HttpServerResponse 404) and CapturedObject: "Response returned status 404." — both already manually resolved as noise.

What

captureUnexpectedDefect now skips benign 404 control-flow defects before calling captureException:

  • Effect HttpServerResponse defects with status === 404 (reusing the isHttpServerResponse guard already used in the billing handler)
  • The thrown-response 404 that PostHog records as "Response returned status 404."

These are benign control flow from unmatched routes, not real errors. Genuine defects still flow through unchanged, and the 404 responses / request metrics are untouched.

Note

I couldn't run aube run check / aube run test — the aube toolchain and node_modules aren't available in this environment. The change is small and the two defect shapes were confirmed against the live exception data.


Created with PostHog Code from an inbox report.

Internet vulnerability scanners constantly probe non-existent routes
(`/.env`, `/.git/config`, `/admin/*`, etc.). The resulting 404s travel
through the Effect defect channel and were forwarded to PostHog's
`captureException` by the global capture hook, flooding error tracking
with two noisy issues (`CapturedNonError` and `CapturedObject:
"Response returned status 404."`) and burning triage time.

These 404s are benign control flow, not real errors. `captureUnexpectedDefect`
now skips them before calling `captureException`: Effect `HttpServerResponse`
defects with status 404, and the thrown-response 404 captured as
"Response returned status 404.". Genuine defects are unaffected.

Generated-By: PostHog Code
Task-Id: 595ab1eb-bf72-49a7-b26b-d2f99d407b4f
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