Skip to content

Commit 96cd99d

Browse files
authored
fix(fs): ignore ELOOP errors during file scanning (#1320)
Previously, `ELOOP` errors (too many symbolic links encountered, often due to cyclic symlinks) were being reported to Sentry when the CLI scanned for files like `.env.local`. The `isIgnorableFileError` function in `src/lib/dsn/fs-utils.ts` did not include `ELOOP` in its allowlist of file system errors that should be silently ignored. This led to noisy Sentry captures for expected filesystem conditions. This change adds `ELOOP` to the list of ignorable error codes in `isIgnorableFileError` and updates the corresponding JSDoc, ensuring these errors are now correctly handled and not reported. Fixes [CLI-2CK](https://sentry.sentry.io/issues/7642577038/?seerDrawer=true) <sub>Comment `@sentry <feedback>` on this PR to have Autofix iterate on the changes.</sub> Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com>
1 parent dd0af5e commit 96cd99d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/lib/dsn/fs-utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import * as Sentry from "@sentry/node-core/light";
1818
* - EISDIR: Path is a directory, not a file (e.g., `.env/` directory instead of `.env` file)
1919
* - ENOTDIR: A path component is not a directory (e.g., `/file.txt/child`)
2020
* - EINVAL: Invalid argument (e.g., scandir on a special/virtual filesystem entry like /proc paths)
21+
* - ELOOP: Too many symbolic links (e.g., cyclic symlink encountered during scan)
2122
*
2223
* All other errors are unexpected and should be reported to Sentry.
2324
*
@@ -33,7 +34,8 @@ function isIgnorableFileError(error: unknown): boolean {
3334
code === "EPERM" ||
3435
code === "EISDIR" ||
3536
code === "ENOTDIR" ||
36-
code === "EINVAL"
37+
code === "EINVAL" ||
38+
code === "ELOOP"
3739
);
3840
}
3941
return false;

0 commit comments

Comments
 (0)