{"record":{"id":"ca3840346d57bb9e","repo":"microsoft/typescript-go","slug":"unknown-error","errorCode":null,"errorMessage":"unknown error","messagePattern":"unknown error","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/fswatch/windows.go","lineNumber":109,"sourceCode":"//     - FILE_ACTION_REMOVED / RENAMED_OLD_NAME → events.remove + tree.remove\n//  4. Call dirWatch.notify() to trigger the debouncer.\n//\n// Error recovery:\n//   - ERROR_OPERATION_ABORTED → normal shutdown (CancelIoEx was called).\n//   - ERROR_INVALID_PARAMETER → shrink buffer to 64 KB (network share limit).\n//   - ERROR_NOTIFY_ENUM_DIR  → ErrOverflow (too many changes queued).\n//   - ERROR_ACCESS_DENIED    → check if the watched dir was deleted.\n//\n// Shutdown:\n//   close(stopCh) → CancelIoEx cancels in-flight IO → run() goroutine\n//   exits → deferred CloseHandle closes the directory handle → doneCh closed.\n// ---------------------------------------------------------------------------\n\nvar (\n\terrGetFileInfo         = errors.New(\"could not get file information\")\n\terrReadChanges         = errors.New(\"failed to read changes\")\n\terrGetOverlappedResult = errors.New(\"GetOverlappedResult failed\")\n\terrUnknown             = errors.New(\"unknown error\")\n)\n\nconst (\n\tdefaultBufSize = 1024 * 1024\n\tnetworkBufSize = 64 * 1024\n\n\tnotifyChangeFilter = windows.FILE_NOTIFY_CHANGE_FILE_NAME |\n\t\twindows.FILE_NOTIFY_CHANGE_DIR_NAME |\n\t\twindows.FILE_NOTIFY_CHANGE_SIZE |\n\t\twindows.FILE_NOTIFY_CHANGE_LAST_WRITE\n)\n\n// windowsBackend.\ntype windowsBackend struct {\n\twatcherBase\n}\n\nfunc init() {","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/microsoft/typescript-go/blob/1bcfa18d79a3be41772223d5c05dfe4480e614ff/internal/fswatch/windows.go#L91-L127","documentation":"Terminal catch-all from the Windows backend: processCompletion received a completion error that is none of the recognized codes (ERROR_OPERATION_ABORTED shutdown, ERROR_INVALID_PARAMETER buffer shrink, ERROR_NOTIFY_ENUM_DIR overflow, ERROR_ACCESS_DENIED with the directory gone). The subscription calls fatal() and delivers the error wrapped with ErrWatchTerminated; the underlying code is not included, so OS-level tracing is needed to diagnose.","triggerScenarios":"Unusual completion errors from filter drivers or filesystem redirectors (ERROR_NOT_SUPPORTED, device-specific codes). ERROR_ACCESS_DENIED when the directory still exists, for example permissions were revoked rather than the directory deleted, which falls through to this default branch.","commonSituations":"Antivirus/EDR filter drivers interfering with directory handles. Third-party filesystem drivers. Permission changes on the watched directory while it still exists.","solutions":["Treat it as terminal: on ErrWatchTerminated, call Close() on the Watch","Reproduce while tracing with Process Monitor or ETW to capture the real completion error","If permissions were revoked, restore them and re-subscribe","Exclude the watched tree from over-aggressive filter drivers if the product allows it"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"func(events []fswatch.Event, err error) {\n    if errors.Is(err, fswatch.ErrWatchTerminated) {\n        if strings.Contains(err.Error(), \"unknown error\") {\n            // unrecognized completion error: trace with Process Monitor while reproducing\n        }\n        watch.Close()\n        return\n    }\n    apply(events)\n}","preventionTips":["Watch for filter drivers (antivirus/EDR) when unexplained terminal errors appear","Capture the real completion error with ETW or Process Monitor during reproduction","Check whether permissions on the watched directory changed while it still existed","Close terminated watches and re-subscribe after the root cause is fixed"],"tags":["windows","unknown-error","filter-driver","terminal"],"backgroundTag":null,"analyzedSha":"1bcfa18d79a3be41772223d5c05dfe4480e614ff","analyzedAt":"2026-08-16T02:12:00.115Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}