microsoft/typescript-go · error

unable to open kqueue: %w

Error message

unable to open kqueue: %w

What it means

Error "unable to open kqueue: %w" thrown in microsoft/typescript-go.

Source

Thrown at internal/fswatch/kqueue.go:154

func newKqueueBackend() *kqueueBackend {
	b := &kqueueBackend{
		kq:              -1,
		pipeFDs:         [2]int{-1, -1},
		subsByPath:      map[string][]*kqueueSubscription{},
		fdToEntry:       map[int]*dirEntry{},
		endedSignal:     make(chan struct{}),
		watchersTouched: make(map[*dirWatch]struct{}),
	}
	b.pipeWriteFD.Store(-1)
	b.watcherBase.init(b)
	return b
}

func (b *kqueueBackend) start() error {
	kq, err := unix.Kqueue()
	if err != nil {
		return fmt.Errorf("unable to open kqueue: %w", err)
	}
	b.kq = kq
	defer func() {
		b.closeSubscriptions()
		b.closeFDs()
		close(b.endedSignal)
	}()

	if err := unix.Pipe(b.pipeFDs[:]); err != nil {
		return fmt.Errorf("unable to open pipe: %w", err)
	}
	b.pipeWriteFD.Store(int32(b.pipeFDs[1]))

	// WatchDirectory kqueue to the read side of the pipe so we can break the
	// loop on shutdown. SetKevent handles the per-arch Ident type
	// (uint64 on 64-bit, uint32 on 386/arm).
	var pipeEv unix.Kevent_t
	unix.SetKevent(&pipeEv, b.pipeFDs[0], unix.EVFILT_READ, unix.EV_ADD|unix.EV_CLEAR)

View on GitHub (pinned to 1bcfa18d79)

When it happens

Trigger: Thrown at internal/fswatch/kqueue.go:154 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/3bd954f8cf7d5e5f. Report an issue: GitHub.