Skip to content

fix(error-reporting): silence ValidationError in classifySilenced#1235

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

fix(error-reporting): silence ValidationError in classifySilenced#1235
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-20m-silence-validation-error

Conversation

@sentry

@sentry sentry Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Previously, ValidationErrors, such as those arising from invalid user input for flags like --action-match in sentry alert issues create, were being reported to Sentry as issues.

These errors represent user input mistakes and should be silenced to prevent noise in Sentry. The root cause was that classifySilenced() in src/lib/error-reporting.ts did not explicitly handle ValidationError, causing it to fall through and be captured.

This change updates src/lib/error-reporting.ts to:

  1. Add "validation_error" to the SilenceReason type.
  2. Include a check in classifySilenced() to return "validation_error" when an instanceof ValidationError is encountered.

This ensures that ValidationErrors are now correctly silenced and tracked via the cli.error.silenced metric, rather than being sent as Sentry issues.

Fixes CLI-20M

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

@github-actions github-actions Bot added the risk: high PR risk score: high label Jul 14, 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-1235/

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

Comment on lines +95 to +97
if (error instanceof ValidationError) {
return "validation_error";
}

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: The change to silence ValidationError in classifySilenced will cause multiple existing tests to fail, as they expect these errors to be reported.
Severity: HIGH

Suggested Fix

The tests that verify the behavior of ValidationError need to be updated to align with the new intention of silencing these errors. Either remove the ValidationError case from the test that expects it not to be silenced, or update the integration tests to no longer expect Sentry.withScope to be called for ValidationError. Alternatively, if ValidationError should not be silenced, revert this change.

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 modification in `classifySilenced` to handle `ValidationError` will
cause existing tests to fail. A unit test expects `classifySilenced(new
ValidationError(...))` to return `null`, but it will now return `"validation_error"`.
Additionally, several integration tests rely on `reportCliError` processing
`ValidationError` instances and invoking `Sentry.withScope`. Since the error is now
silenced, `reportCliError` will return early, and these tests, which expect Sentry scope
tags to be set, will fail because the test files were not updated to reflect this new
behavior.

Also affects:

  • test/lib/error-reporting.test.ts:321~329

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: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants