{"record":{"id":"97fb81a095466b88","repo":"microsoft/typescript-go","slug":"w-watched-directory-removed-97fb81","errorCode":null,"errorMessage":"%w: watched directory removed","messagePattern":"%w: watched directory removed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/fswatch/fsevents_darwin.go","lineNumber":576,"sourceCode":"\n\t\t\t// Skip events for the watched directory itself unless it's been\n\t\t\t// removed. fseventsd reports a change on the watched dir when a\n\t\t\t// child is added or removed; subscribers observe changes *within*\n\t\t\t// the directory, not the dir's own metadata churn.\n\t\t\t// (A removal of the dir is still propagated because Watcher\n\t\t\t// relies on it to tear down the stream.)\n\t\t\tif displayPath == w.dir && !isRemoved && !isRenamed {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tswitch {\n\t\t\tcase isRemoved && !isCreated:\n\t\t\t\tif displayPath == w.dir {\n\t\t\t\t\tw.events.removeWatchRootAt(displayPath, eventID)\n\t\t\t\t} else {\n\t\t\t\t\tw.events.removeAt(displayPath, eventID)\n\t\t\t\t}\n\t\t\t\tif w.terminateCallbacksForDeletedRoot(displayPath, eventID, fmt.Errorf(\"%w: watched directory removed\", ErrWatchTerminated)) {\n\t\t\t\t\ttouched[w] = struct{}{}\n\t\t\t\t}\n\t\t\t\tif displayPath == w.dir {\n\t\t\t\t\twatch.state.terminated.Store(true)\n\t\t\t\t\tw.events.setError(fmt.Errorf(\"%w: watched directory removed\", ErrWatchTerminated))\n\t\t\t\t}\n\t\t\tcase isRenamed || (isRemoved && isCreated):\n\t\t\t\tif !pathExistsKnown {\n\t\t\t\t\tvar st unix.Stat_t\n\t\t\t\t\tpathExists = unix.Lstat(rawPath, &st) == nil\n\t\t\t\t\tpathExistsKnown = true\n\t\t\t\t}\n\t\t\t\tif pathExists {\n\t\t\t\t\tif displayPath == w.dir {\n\t\t\t\t\t\tw.events.updateWatchRootAt(displayPath, eventID)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tw.events.updateAt(displayPath, eventID)\n\t\t\t\t\t}","sourceCodeStart":558,"sourceCodeEnd":594,"githubUrl":"https://github.com/microsoft/typescript-go/blob/1bcfa18d79a3be41772223d5c05dfe4480e614ff/internal/fswatch/fsevents_darwin.go#L558-L594","documentation":"Error \"%w: watched directory removed\" thrown in microsoft/typescript-go.","triggerScenarios":"Thrown at internal/fswatch/fsevents_darwin.go:576 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"}