{"record":{"id":"3bd954f8cf7d5e5f","repo":"microsoft/typescript-go","slug":"unable-to-open-kqueue-w","errorCode":null,"errorMessage":"unable to open kqueue: %w","messagePattern":"unable to open kqueue: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/fswatch/kqueue.go","lineNumber":154,"sourceCode":"\nfunc newKqueueBackend() *kqueueBackend {\n\tb := &kqueueBackend{\n\t\tkq:              -1,\n\t\tpipeFDs:         [2]int{-1, -1},\n\t\tsubsByPath:      map[string][]*kqueueSubscription{},\n\t\tfdToEntry:       map[int]*dirEntry{},\n\t\tendedSignal:     make(chan struct{}),\n\t\twatchersTouched: make(map[*dirWatch]struct{}),\n\t}\n\tb.pipeWriteFD.Store(-1)\n\tb.watcherBase.init(b)\n\treturn b\n}\n\nfunc (b *kqueueBackend) start() error {\n\tkq, err := unix.Kqueue()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to open kqueue: %w\", err)\n\t}\n\tb.kq = kq\n\tdefer func() {\n\t\tb.closeSubscriptions()\n\t\tb.closeFDs()\n\t\tclose(b.endedSignal)\n\t}()\n\n\tif err := unix.Pipe(b.pipeFDs[:]); err != nil {\n\t\treturn fmt.Errorf(\"unable to open pipe: %w\", err)\n\t}\n\tb.pipeWriteFD.Store(int32(b.pipeFDs[1]))\n\n\t// WatchDirectory kqueue to the read side of the pipe so we can break the\n\t// loop on shutdown. SetKevent handles the per-arch Ident type\n\t// (uint64 on 64-bit, uint32 on 386/arm).\n\tvar pipeEv unix.Kevent_t\n\tunix.SetKevent(&pipeEv, b.pipeFDs[0], unix.EVFILT_READ, unix.EV_ADD|unix.EV_CLEAR)","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/microsoft/typescript-go/blob/1bcfa18d79a3be41772223d5c05dfe4480e614ff/internal/fswatch/kqueue.go#L136-L172","documentation":"Error \"unable to open kqueue: %w\" thrown in microsoft/typescript-go.","triggerScenarios":"Thrown at internal/fswatch/kqueue.go:154 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1bcfa18d79a3be41772223d5c05dfe4480e614ff","analyzedAt":"2026-08-16T02:12:00.115Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}