Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
`fs.watch()` listener called with `null` `filename` argument | GoodFirstPicks

`fs.watch()` listener called with `null` `filename` argument

nodejs/node 3 comments 1mo ago
View on GitHub
highopenScope: somewhat clearSkill match: maybeTest focusedNode.jsJavaScript

Why this is a good first issue

Platform-specific kernel bug affecting fs.watch behavior.

AI Summary

The issue involves fs.watch() returning null for the filename argument on SunOS/SmartOS, similar to a known FreeBSD kernel bug. The problem is reproducible and test-focused, but requires deep understanding of platform-specific kernel behavior and fs module internals. The main blocker is the potential kernel-level nature of the bug.

Issue Description

Version

main (commit 159ae48f8cd3)

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 passes if this option is set to `true`.
});

watcher.on('change', function (event, filename) {
  console.log(event, filename);

  if (filename === 'file.txt') {
    watcher.close();
  }
});

setTimeout(function () {
  fs.writeFileSync('file.txt', 'data');
}, 100);

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

Always.

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

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.

What do you see instead?

change null is written to the standard output and the process does not exit.

Additional information

No response

GitHub Labels

fsfreebsdsmartos

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!

Risk Flags

  • platform-specific
  • kernel-level issue
Loading labels...

Details

Points10 pts
Difficultyhigh
Scopesomewhat clear
Skill Matchmaybe
Test Focusedyes