Skip to content
This repository was archived by the owner on Oct 23, 2026. It is now read-only.

fix(error-reporting): Silence ValidationError as user input error - #1616

Closed
sentry[bot] wants to merge 3 commits into
mainfrom
seer/fix/cli-1fn-silence-validation-error
Closed

sentry[bot] wants to merge 3 commits into
mainfrom
seer/fix/cli-1fn-silence-validation-error

Conversation

@sentry

@sentry sentry Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

This PR addresses CLI-1FN by preventing ValidationError instances from being reported to Sentry as issues, as they represent user input errors that are already handled gracefully by the CLI.

Changes:

  1. packages/cli/src/lib/error-reporting.ts:

    • Modified the classifySilenced function to catch all ValidationError instances (not just project.ambiguous_org) and classify them as "user_input_error". This ensures that user-facing validation errors, such as a non-existent directory path for sourcemap uploads, are no longer sent to Sentry.
  2. packages/cli/test/lib/error-reporting.test.ts:

    • Updated unit tests to reflect the new silencing behavior for ValidationErrors. Removed them from the "does NOT silence" test array and added explicit tests to assert that they now return "user_input_error".
    • Updated integration tests that previously expected ValidationErrors to be captured, now verifying that they are silenced and emit the cli.error.silenced metric.

Additional Fix (Addressing CI Failure):

During verification, a pre-existing bug in the pagination logic was discovered and fixed, which caused unrelated unit tests to fail. This fix is included to ensure the PR passes CI:

  1. packages/cli/src/lib/api/infrastructure.ts:

    • Corrected the paginate function to consistently request API_MAX_PER_PAGE items per page. Previously, it would request a smaller perPage for the last page if limit was not a multiple of API_MAX_PER_PAGE. The autoPaginate helper now handles trimming any overshoot and dropping the nextCursor when the requested limit is reached.
    • Updated the JSDoc for paginate to reflect this change.
  2. packages/cli/test/lib/api/infrastructure.test.ts, packages/cli/test/lib/api/replays.test.ts, packages/cli/test/lib/api/traces.test.ts:

    • Updated relevant unit tests in these files to expect per_page=100 (or API_MAX_PER_PAGE) for all pagination requests, aligning with the corrected paginate function's behavior.

Fixes CLI-1FN

@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.

@vercel

vercel Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cli Ready Ready Preview Sep 22, 2026 11:04am UTC
1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Sep 22, 2026 11:04am UTC

Request Review

@vercel
vercel Bot temporarily deployed to Preview – sentry-local September 22, 2026 10:46 Inactive
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Sep 22, 2026
@sentry sentry Bot changed the title fix(error-reporting): Silence ValidationError as user input error fix(error-reporting): silence ValidationError as user input error Sep 22, 2026
@vercel
vercel Bot temporarily deployed to Preview – sentry-local September 22, 2026 10:54 Inactive
@sentry sentry Bot changed the title fix(error-reporting): silence ValidationError as user input error fix(error-reporting): Silence ValidationError as user input error Sep 22, 2026
@sentry-junior

sentry-junior Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Closing as part of archiving getsentry/cli; the CLI now lives in getsentry/toolkit. Ported in narrower form as getsentry/toolkit#1606: only the directory ValidationError from CLI-1FN is silenced. Toolkit deliberately silences ValidationErrors by field rather than blanket. The paginate() change would also have undone #1615 (remaining-budget pages).

@sentry-junior sentry-junior Bot closed this Oct 22, 2026
BYK added a commit to getsentry/toolkit that referenced this pull request Oct 23, 2026
…1606)

Two kinds of user-environment failures still show up in Sentry as CLI
issues:

- **`TypeError: terminated`**
([CLI-2AD](https://sentry.sentry.io/issues/7624167935/)): undici throws
this when the connection drops while the response body is streaming.
#1548 already retries finite GET bodies, so one that still gets through
is the same offline/proxy noise as `fetch failed`. `isNetworkError()`
now matches it too.
- **Bad sourcemap directory**
([CLI-1FN](https://sentry.sentry.io/issues/7439660891/)):
`assertDirectoryReadable` throws a `ValidationError` with field
`"directory"` when the directory doesn't exist, isn't a directory, or
can't be read. This is now silenced the same way as the missing
`--input` file case (CLI-1JY).

The original getsentry/cli#1616 silenced **every** `ValidationError` and
changed `paginate()` back to fixed page sizes. That conflicts with the
targeted silencing policy here and with getsentry/cli#1615, so this port
only covers the sourcemap directory case.

Ported from getsentry/cli#1653 and getsentry/cli#1616, which are being
closed with the repo archive.

<!-- junior-request-attribution:start -->
via **BYK**.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:local%3Aweb%3Ad9c5b0de1ecf3c7114be7025 -->

--

[View Junior Session in
Sentry](https://sentry.sentry.io/explore/conversations/local%3Aweb%3Ad9c5b0de1ecf3c7114be7025/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: BYK <burak.kaya@sentry.io>

This branch was successfully deployed

1 active and 1 inactive deployments
Preview – cli — c873d3c1 Deployed Sep 22, 2026 by vercel[bot]
Preview – sentry-local — c873d3c1 Deployed Sep 22, 2026 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants