microsoft/typescript-go · error

unable to remove dirWatch: %w

Error message

unable to remove dirWatch: %w

What it means

Error "unable to remove dirWatch: %w" thrown in microsoft/typescript-go.

Source

Thrown at internal/fswatch/inotify_linux.go:417

func (b *inotifyBackend) closeWatch(w *dirWatch) error {
	var firstErr error
	for wd, list := range b.subscriptions {
		kept := list[:0]
		removedAny := false
		for _, s := range list {
			if s.dirWatch == w {
				removedAny = true
				continue
			}
			kept = append(kept, s)
		}
		if !removedAny {
			continue
		}
		if len(kept) == 0 {
			if _, err := unix.InotifyRmWatch(b.inotify, uint32(wd)); err != nil && firstErr == nil {
				firstErr = &dirWatchError{
					err:      fmt.Errorf("unable to remove dirWatch: %w", err),
					dirWatch: w,
				}
			}
			delete(b.subscriptions, wd)
		} else {
			b.subscriptions[wd] = kept
		}
	}
	return firstErr
}

View on GitHub (pinned to 1bcfa18d79)

When it happens

Trigger: Thrown at internal/fswatch/inotify_linux.go:417 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/ae1c352e50a558b4. Report an issue: GitHub.