Title: `fs.watch()` listener called with `null` `filename` argument · Issue #61520 · nodejs/node · GitHub
Open Graph Title: `fs.watch()` listener called with `null` `filename` argument · Issue #61520 · nodejs/node
X Title: `fs.watch()` listener called with `null` `filename` argument · Issue #61520 · nodejs/node
Description: Version main (commit 159ae48) Platform SunOS smartos 5.11 joyent_20260122T000642Z i86pc i386 i86pc Subsystem fs What steps will reproduce the bug? const fs = require('fs'); const watcher = fs.watch('.', { recursive: false // The test pas...
Open Graph Description: Version main (commit 159ae48) Platform SunOS smartos 5.11 joyent_20260122T000642Z i86pc i386 i86pc Subsystem fs What steps will reproduce the bug? const fs = require('fs'); const watcher = fs.watch...
X Description: Version main (commit 159ae48) Platform SunOS smartos 5.11 joyent_20260122T000642Z i86pc i386 i86pc Subsystem fs What steps will reproduce the bug? const fs = require('fs'); const watcher = ...
Opengraph URL: https://github.com/nodejs/node/issues/61520
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`fs.watch()` listener called with `null` `filename` argument","articleBody":"### Version\n\nmain (commit 159ae48f8cd3)\n\n### Platform\n\n```text\nSunOS smartos 5.11 joyent_20260122T000642Z i86pc i386 i86pc\n```\n\n### Subsystem\n\nfs\n\n### What steps will reproduce the bug?\n\n```js\nconst fs = require('fs');\n\nconst watcher = fs.watch('.', {\n recursive: false // The test passes if this option is set to `true`.\n});\n\nwatcher.on('change', function (event, filename) {\n console.log(event, filename);\n\n if (filename === 'file.txt') {\n watcher.close();\n }\n});\n\nsetTimeout(function () {\n fs.writeFileSync('file.txt', 'data');\n}, 100);\n```\n\n### How often does it reproduce? Is there a required condition?\n\nAlways.\n\n### What is the expected behavior? Why is that the expected behavior?\n\n`change file.txt` is written to the standard output and the process exits. This is what happens when the `recursive` option is set to `true`.\n\n### What do you see instead?\n\n`change null` is written to the standard output and the process does not exit.\n\n### Additional information\n\n_No response_","author":{"url":"https://github.com/lpinca","@type":"Person","name":"lpinca"},"datePublished":"2026-01-25T18:36:12.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/61520/node/issues/61520"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:32bd81e2-fd1f-1481-1c1a-d9f152f4c5fc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CA5E:3691A9:E6AE35:139F1B7:6A4C5EAF |
| html-safe-nonce | 31b3f609a274c0328b7f8f8839aaa1391fedbda53b977a65877d03672a071882 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQTVFOjM2OTFBOTpFNkFFMzU6MTM5RjFCNzo2QTRDNUVBRiIsInZpc2l0b3JfaWQiOiI1MzAxMjIxNTM2MTU3MTYzMTgzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3ee32f03ab605fad09ffda5c72b3969f3981d8addfdbeebced22c55710767a56 |
| hovercard-subject-tag | issue:3853681403 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/61520/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a80d4d67452a49b118a1f0e89050fbdc98ff6210df5d45ef3e227c109d9c173b/nodejs/node/issues/61520 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a80d4d67452a49b118a1f0e89050fbdc98ff6210df5d45ef3e227c109d9c173b/nodejs/node/issues/61520 |
| og:image:alt | Version main (commit 159ae48) Platform SunOS smartos 5.11 joyent_20260122T000642Z i86pc i386 i86pc Subsystem fs What steps will reproduce the bug? const fs = require('fs'); const watcher = fs.watch... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lpinca |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 14099438da5379150f15a2892474c7c7e6c0e55e |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width