From 7ea060fae2840b588174615a92d0c6ad9281b3f1 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Mon, 19 Oct 2026 12:34:18 +0000 Subject: [PATCH] fix(cli): Ignore ENOTCONN from disconnected mounts during file scans Scanning into a stale or disconnected FUSE/network mount makes readdir fail with ENOTCONN. handleFileError treated that as unexpected and captured it as an error, even though the walk skips the directory and continues. Treat ENOTCONN like ETIMEDOUT. --- packages/cli/src/lib/dsn/fs-utils.ts | 2 ++ packages/cli/test/lib/dsn/fs-utils.test.ts | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/packages/cli/src/lib/dsn/fs-utils.ts b/packages/cli/src/lib/dsn/fs-utils.ts index eaf4838a9..d41eeec87 100644 --- a/packages/cli/src/lib/dsn/fs-utils.ts +++ b/packages/cli/src/lib/dsn/fs-utils.ts @@ -20,6 +20,7 @@ import * as Sentry from "@sentry/node-core/light"; * - EINVAL: Invalid argument (e.g., scandir on a special/virtual filesystem entry like /proc paths) * - ELOOP: Too many symbolic links (e.g., cyclic symlink encountered during scan) * - ETIMEDOUT: Connection timed out (e.g., transient read on a network or cloud-mounted filesystem) + * - ENOTCONN: Transport endpoint is not connected (e.g., a stale or disconnected FUSE/network mount) * - Unknown system error: Non-POSIX kernel errors on macOS (e.g., errno -11 / EAGAIN on .trace bundles) * that Node.js cannot map to a standard code string * @@ -42,6 +43,7 @@ function isIgnorableFileError(error: unknown): boolean { code === "EINVAL" || code === "ELOOP" || code === "ETIMEDOUT" || + code === "ENOTCONN" || // macOS surfaces non-POSIX kernel errors (e.g. errno -11 on .trace bundles) // as "Unknown system error -N" without a standard POSIX code string. code === "UNKNOWN" diff --git a/packages/cli/test/lib/dsn/fs-utils.test.ts b/packages/cli/test/lib/dsn/fs-utils.test.ts index 2f6bc6bfc..03043662b 100644 --- a/packages/cli/test/lib/dsn/fs-utils.test.ts +++ b/packages/cli/test/lib/dsn/fs-utils.test.ts @@ -86,6 +86,17 @@ describe("handleFileError", () => { expect(captureException).not.toHaveBeenCalled(); }); + test("ENOTCONN — scandir on a disconnected network or FUSE mount", () => { + handleFileError( + errnoError("ENOTCONN", "ENOTCONN: socket is not connected, scandir"), + { + operation: "scan.walk.readdir", + path: "/mnt/remote", + }, + ); + expect(captureException).not.toHaveBeenCalled(); + }); + test("UNKNOWN code — non-POSIX error with UNKNOWN code", () => { handleFileError(errnoError("UNKNOWN", "Unknown system error -11"), { operation: "scandir",