microsoft/typescript-go · error

inotify_add_watch on '%s' failed: %w

Error message

inotify_add_watch on '%s' failed: %w

What it means

Error "inotify_add_watch on '%s' failed: %w" thrown in microsoft/typescript-go.

Source

Thrown at internal/fswatch/inotify_linux.go:219

// Called by removeSharedBackend when the last watch drops. Reads
// the pipe write fd via atomic so it's safe to race against the start
// goroutine's deferred closeFDs.
func (b *inotifyBackend) shutdown() {
	fd := b.pipeWriteFD.Load()
	if fd < 0 {
		return
	}
	_, _ = unix.Write(int(fd), []byte{'X'})
	<-b.endedSignal
}

// subscribe mirrors `inotifyBackend::subscribe`. Called via the watcherBase
// virtual dispatch under b.mu (so it's serialized against handleEvent).
func (b *inotifyBackend) subscribe(w *dirWatch) error {
	if !w.recursive {
		if _, err := b.watchDir(w, w.dir, w.physicalDir); err != nil {
			return &dirWatchError{
				err:      fmt.Errorf("inotify_add_watch on '%s' failed: %w", w.dir, err),
				dirWatch: w,
			}
		}
		return nil
	}
	if err := walkDir(w.physicalDir, true, func(watchPath string, isDir bool) error {
		if !isDir {
			return nil
		}
		path := w.displayPath(watchPath)
		if _, err := b.watchDir(w, path, watchPath); err != nil {
			return &dirWatchError{
				err:      fmt.Errorf("inotify_add_watch on '%s' failed: %w", path, err),
				dirWatch: w,
			}
		}
		return nil
	}); err != nil {

View on GitHub (pinned to 1bcfa18d79)

When it happens

Trigger: Thrown at internal/fswatch/inotify_linux.go:219 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16). Data as JSON: /api/errors/4f24b5ba84d5d2d6. Report an issue: GitHub.