Skip to content

fix(error-reporting): silence ValidationError for invalid trace IDs#1226

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-1gp-validation-error
Open

fix(error-reporting): silence ValidationError for invalid trace IDs#1226
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-1gp-validation-error

Conversation

@sentry

@sentry sentry Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Previously, ValidationError instances, specifically those arising from invalid trace IDs provided to commands like sentry.trace.view, sentry.trace.logs, and sentry.span.view, were being reported to Sentry as unhandled errors (CLI-1GP).

The root cause was that the classifySilenced() function in src/lib/error-reporting.ts did not explicitly recognize ValidationError as a user-input error that should be silenced. This led to noise in Sentry for expected user mistakes.

This fix addresses the issue by:

  1. Adding "validation_error" to the SilenceReason union type.
  2. Implementing a check for ValidationError within classifySilenced(), returning "validation_error" to prevent these errors from being reported.
  3. Updating the module-level JSDoc comment in error-reporting.ts to reflect this new silencing rule.
  4. Adjusting the corresponding test in test/lib/error-reporting.test.ts to assert that ValidationError is now correctly silenced.

Fixes CLI-1GP

Comment @sentry <feedback> on this PR to have Autofix iterate on the changes.

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Jul 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-1226/

Built to branch gh-pages at 2026-07-10 22:42 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6284299. Configure here.

"validation_error",
);
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale ValidationError capture tests

Medium Severity

Silencing ValidationError in classifySilenced makes reportCliError return before withScope, but the integration tests at lines 491–526 still use capturedScopeTags with ValidationError and expect cli_error.* tags from the capture path. Those expectations no longer match behavior and the suite should fail.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6284299. Configure here.

Comment on lines +95 to +97
// A ValidationError means the user supplied malformed input (e.g. a project
// slug where a 32-char hex trace ID was required). It is never a CLI bug —
// the CLI correctly rejects the input and displays an actionable message.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Silencing ValidationError causes reportCliError to return early, which will break new tests in this PR that expect Sentry tags to be set for this error type.
Severity: HIGH

Suggested Fix

The new tests for ValidationError tagging should be removed or modified. Since ValidationError is now intentionally silenced and not reported to Sentry with scope, the tests that assert on its Sentry scope tags are no longer valid. Alternatively, if tagging is still desired, the early return in reportCliError for silenced errors needs to be reconsidered.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: src/lib/error-reporting.ts#L95-L97

Potential issue: The pull request modifies `classifySilenced` to treat `ValidationError`
as a silenced error. This change causes the `reportCliError` function to return early,
before `Sentry.withScope` is called. However, the PR also introduces new integration
tests that rely on a `capturedScopeTags` helper function. This helper mocks
`Sentry.withScope` to verify that specific tags are set for `ValidationError`. Because
`Sentry.withScope` is no longer invoked for these errors, the tests will receive an
empty set of tags, causing their assertions to fail and breaking the test suite.

Also affects:

  • test/lib/error-reporting.test.ts:492~518

Did we get this right? 👍 / 👎 to inform future reviews.

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

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants