GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: suppress stats errors for unstat-able paths in watch-event path by danielroe · Pull Request #326 · webpack/watchpack

Conversation

@danielroe

@danielroe danielroe commented Jul 20, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

this ignores EINVAL, EACCES and ENODEV lstat errors on watch events, following up on #298

we noticed in this in CI (search for EINVAL in the logs)

this is a harmless situation and the fact that we already resolved #187 for initial scan suggests it's safe to do the same for watch events, and with the same motivation.

What kind of change does this PR introduce?

fix

Did you add tests for your changes?

yes

Does this PR introduce a breaking change?

no

Use of AI

I used AI to:

  1. identify the cause of the log I was seeing in CI
  2. identify the lines of code responsible for the error
  3. search for similar issues or pull requests before opening this one

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@danielroe
fix: suppress stats errors for unstat-able paths in watch-event path
999dc1d
Copilot AI review requested due to automatic review settings July 20, 2026 14:51
@changeset-bot

changeset-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 999dc1d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
watchpack Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Copilot started reviewing on behalf of danielroe July 20, 2026 14:52
View session
Copilot AI reviewed Jul 20, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Pull request overview

This PR extends Watchpack’s existing “permission/invalid-path” error suppression from the initial scan path to the watch-event path, preventing noisy Watchpack Error (stats) logs when lstat fails with known “unstat-able” error codes (e.g. protected Windows system files, unreadable mounts).

Changes:

  • Suppress onStatsError logging for EACCES, ENODEV, and Windows-only EINVAL during watch events in DirectoryWatcher.
  • Add Jest coverage to assert no stats-error logging occurs for these watch-event lstat failures.
  • Add a changeset documenting the patch-level behavior change.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
lib/DirectoryWatcher.js Suppresses specific lstat error codes in the watch-event path, aligning behavior with initial scan suppression.
test/DirectoryWatcher.test.js Adds regression tests ensuring suppressed lstat errors during watch events do not log Watchpack Error (stats).
.changeset/silence-stats-errors-watch-events.md Documents the patch change in release notes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread test/DirectoryWatcher.test.js
Comment on lines +394 to +404
testHelper.tick(500, () => {
// eslint-disable-next-line jsdoc/reject-any-type
/** @type {any} */ (fs).lstat = originalLstat;
a.close();
const printed = errorSpy.mock.calls
.map((call) => String(call[0]))
.filter((msg) => msg.includes("Watchpack Error (stats)"));
errorSpy.mockRestore();
expect(printed).toEqual([]);
done();
});

@danielroe danielroe Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I'm not sure this is true.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@alexander-akait

alexander-akait commented Jul 20, 2026

Copy link
Copy Markdown
Member

@danielroe Thanks for the PR, can you describe cases when you are getting them?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@danielroe

danielroe commented Jul 20, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

I think the scenario is that:

  • we are running the dev server in hmr tests on windows
  • a dependency can't be resolved, so webpack looks up and up and up to the root (D:/ in the runner)
  • we make some changes deliberately to trigger the watcher
  • watchpack fires on all the paths it looked up on

you can see in the logs: https://github.com/nuxt/nuxt/actions/runs/29737171552/job/88355542839?pr=35740#step:7:1813

you can ignore mentions of rspack; this PR actually runs webpack but wrongly labels it rspack; I'm fixing this separately.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

alexander-akait
alexander-akait approved these changes Oct 13, 2026
View reviewed changes
@alexander-akait
alexander-akait merged commit 465afa5 into webpack:main Oct 13, 2026
1 check passed

Uh oh!

There was an error while loading. Please reload this page.

@danielroe
danielroe deleted the fix/stats-einval branch October 13, 2026 09:56
@github-actions github-actions Bot mentioned this pull request Oct 13, 2026
chore(release): new release #337
Merged
@alexander-akait alexander-akait mentioned this pull request Oct 13, 2026
ci: pin changesets/action to v1 until we move to Changesets CLI v3 #347
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@alexander-akait alexander-akait alexander-akait approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Watchpack Error (initial scan): Error: EACCES: permission denied, lstat '/mnt/c/...'

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@danielroe @alexander-akait
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.