Skip to content

fix(cli): Treat every OS errno from best-effort scans as expected - #1932

Merged
BYK merged 1 commit into
mainfrom
fix/scan-ignore-environmental-fs-errors
Nov 4, 2026
Merged

BYK merged 1 commit into
mainfrom
fix/scan-ignore-environmental-fs-errors

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Fixes the error-reporting half of CLI-1ES. The scan-scope half is #1930.

handleFileError decides which filesystem errors get reported, and it uses an allowlist that has grown one errno per PR: EINVAL (#1286), ELOOP (#1320), ETIMEDOUT (#1217), Unknown system error (#1601), and ENOTCONN. Every new kind of broken mount becomes another Sentry event. CLI-1ES still collects EIO (OneDrive FUSE vault), ECANCELED (macOS .trace bundles), and EINTR (cloud-storage dirs). The walker already skips the unreadable dir either way, so these events tell us nothing actionable.

This flips the check. Any POSIX errno (/^E[A-Z0-9]+$/ or UNKNOWN) counts as an environmental failure, except EMFILE / ENFILE / ENOMEM / EBADF. Those four point at our own descriptor or memory handling, so they still get reported. Node ERR_* codes and errors with no code are still reported too. Skipped paths now show up at debug level, which also fixes the silent catch.

Before: handleFileError() with real libuv-shaped scandir errors:

→ Sentry event: Error: EIO: i/o error, scandir  [operation=scan.walk.readdir]
→ Sentry event: Error: ENOTCONN: socket is not connected, scandir  [operation=scan.walk.readdir]
→ Sentry event: Error: ECANCELED: operation canceled, scandir  [operation=scan.walk.readdir]

(ENOTCONN is already ignored on main. EIO and ECANCELED aren't.)

After: no Sentry events. With --verbose:

[debug] [fs] scan.walk.readdir: skipped unreadable path (EIO: i/o error, scandir '~/OneDrive/Personal Vault')
[debug] [fs] scan.walk.readdir: skipped unreadable path (ENOTCONN: socket is not connected, scandir '/tmp/.mount_app')
[debug] [fs] scan.walk.readdir: skipped unreadable path (ECANCELED: operation canceled, scandir '~/Documents/report.trace')

ENOENT isn't logged, because isRegularFile probes hit it constantly.

via bete.

--

View Session [Sentry]

handleFileError allowlisted errno codes one at a time (EINVAL, ELOOP,
ETIMEDOUT, ENOTCONN, Unknown system error), so each new unhealthy-mount
failure (EIO, ECANCELED, EINTR, ...) became another Sentry event. Invert
the check: ignore any POSIX errno except descriptor/memory exhaustion
that points at a CLI bug, and debug-log skipped paths.

Fixes CLI-1ES

Co-Authored-By: Miguel Betegon <miguel.betegon@sentry.io>
@vercel

vercel Bot commented Nov 4, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Nov 4, 2026 9:42am UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 4, 2026
@betegon
betegon self-requested a review November 4, 2026 10:01

@BYK BYK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Smart

@BYK
BYK merged commit c0c5158 into main Nov 4, 2026
27 checks passed
@BYK
BYK deleted the fix/scan-ignore-environmental-fs-errors branch November 4, 2026 15:01

This branch was previously deployed

1 inactive deployment
Preview — 3113353a Deployed Nov 4, 2026 by vercel[bot]
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.

2 participants