{"record":{"id":"558b7c8048b7ce61","repo":"microsoft/typescript-go","slug":"w-watched-directory-removed-558b7c","errorCode":null,"errorMessage":"%w: watched directory removed","messagePattern":"%w: watched directory removed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/fswatch/windows.go","lineNumber":340,"sourceCode":"\t\tswitch {\n\t\tcase errors.Is(callErr, windows.ERROR_OPERATION_ABORTED):\n\t\t\treturn true\n\t\tcase errors.Is(callErr, windows.ERROR_INVALID_PARAMETER):\n\t\t\ts.mu.Lock()\n\t\t\ts.bufBytes = networkBufSize\n\t\t\ts.mu.Unlock()\n\t\t\treturn false\n\t\tcase errors.Is(callErr, windows.ERROR_NOTIFY_ENUM_DIR):\n\t\t\ts.dirWatch.events.setError(ErrOverflow)\n\t\t\ts.dirWatch.notify()\n\t\t\treturn false\n\t\tcase errors.Is(callErr, windows.ERROR_ACCESS_DENIED):\n\t\t\t// Possibly the watched dir was deleted; check and handle.\n\t\t\tpathPtr, _ := windows.UTF16PtrFromString(s.dirWatch.physicalDir)\n\t\t\tattrs, err := windows.GetFileAttributes(pathPtr)\n\t\t\tif err != nil || attrs == windows.INVALID_FILE_ATTRIBUTES || attrs&windows.FILE_ATTRIBUTE_DIRECTORY == 0 {\n\t\t\t\ts.dirWatch.events.remove(s.dirWatch.dir)\n\t\t\t\ts.dirWatch.events.setError(fmt.Errorf(\"%w: watched directory removed\", ErrWatchTerminated))\n\t\t\t\ts.dirWatch.notify()\n\t\t\t\ts.stop()\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tfallthrough\n\t\tdefault:\n\t\t\ts.fatal(&dirWatchError{err: errUnknown, dirWatch: s.dirWatch})\n\t\t\treturn true\n\t\t}\n\t}\n\n\t// Walk the FILE_NOTIFY_INFORMATION chain.\n\toffset := uint32(0)\n\tif bytes == 0 {\n\t\tbytes = uint32(len(buf))\n\t}\n\tfor offset < bytes {\n\t\tfni := (*windows.FileNotifyInformation)(unsafe.Pointer(&buf[offset]))","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/microsoft/typescript-go/blob/1bcfa18d79a3be41772223d5c05dfe4480e614ff/internal/fswatch/windows.go#L322-L358","documentation":"Error \"%w: watched directory removed\" thrown in microsoft/typescript-go.","triggerScenarios":"Thrown at internal/fswatch/windows.go:340 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"}