Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

watch runner crash with ERR_INVALID_ARG_TYPE #47692

Closed
sosoba opened this issue Apr 24, 2023 · 1 comment
Closed

watch runner crash with ERR_INVALID_ARG_TYPE #47692

sosoba opened this issue Apr 24, 2023 · 1 comment
Labels
watch-mode Issues and PRs related to watch mode

Comments

@sosoba
Copy link
Contributor

sosoba commented Apr 24, 2023

Version

v18.16.0

Platform

Microsoft Windows NT 10.0.22621.0 x64

Subsystem

internal/watch_mode/files_watcher.js

What steps will reproduce the bug?

Use node --watch script.js

How often does it reproduce? Is there a required condition?

When third-party tool written in Java works on the same directory.

What is the expected behavior? Why is that the expected behavior?

Normal running.

What do you see instead?

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
    at __node_internal_captureLargerStackTrace (node:internal/errors:490:5)
    at new NodeError (node:internal/errors:399:5)
    at validateString (node:internal/validators:163:11)
    at resolve (node:path:167:9)
    at FSWatcher.<anonymous> (node:internal/watch_mode/files_watcher:94:30)
    at FSWatcher.emit (node:events:513:28)
    at FSWatcher._handle.onchange (node:internal/fs/watchers:215:12) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Additional information

The reason for the error is the call resolve without checking if the name is not null

watcher.on('change', (eventType, fileName) => this
.#onChange(recursive ? resolve(path, fileName) : path));

Regardles to documentation:

filename is not always guaranteed to be provided. Therefore, don't assume that filename argument is always provided in the callback, and have some fallback logic if it is null.

@MoLow MoLow added the watch-mode Issues and PRs related to watch mode label Apr 24, 2023
cinderblock added a commit to cinderblock/rdt that referenced this issue May 12, 2023
@sosoba
Copy link
Contributor Author

sosoba commented Feb 15, 2024

#49891

@sosoba sosoba closed this as completed Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
watch-mode Issues and PRs related to watch mode
Projects
None yet
Development

No branches or pull requests

2 participants