{"record":{"id":"2b260dc7510dc609","repo":"microsoft/typescript-go","slug":"could-not-get-file-information","errorCode":null,"errorMessage":"could not get file information","messagePattern":"could not get file information","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/fswatch/windows.go","lineNumber":106,"sourceCode":"//  3. Walk the FILE_NOTIFY_INFORMATION linked list:\n//     - FILE_ACTION_ADDED / RENAMED_NEW_NAME  → events.create (→ EventUpdate)\n//     - FILE_ACTION_MODIFIED                  → events.update (→ EventUpdate)\n//     - 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","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/microsoft/typescript-go/blob/1bcfa18d79a3be41772223d5c05dfe4480e614ff/internal/fswatch/windows.go#L88-L124","documentation":"Static error returned synchronously from WatchDirectory on Windows when GetFileInformationByHandle fails immediately after CreateFile succeeded while opening the watched directory in newWindowsSubscription. The handle is closed and the sentinel is returned as-is (no errno attached), so the caller sees exactly 'could not get file information'. It is rare by construction: the open worked but the metadata query failed.","triggerScenarios":"The directory handle is invalidated between CreateFile and the metadata call: the network share dropped, the device was removed, or a filter driver interfered. Filesystem corruption or driver bugs can also produce it.","commonSituations":"UNC network paths on flaky links during subscribe. Removable media ejected at that exact moment. Antivirus or ERM filter drivers that quarantine the directory between the two calls.","solutions":["Retry WatchDirectory after a short backoff; transient handle failures usually clear on the next attempt","Verify with os.Stat that the path is still a readable directory, then re-subscribe","For network shares, stabilize the connection or watch a local mirror","If it persists, trace OS-level failures with Process Monitor to find the interfering driver"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if _, err := os.Stat(dir); err != nil {\n    return err // wait for the directory/share before subscribing\n}","typeGuard":null,"tryCatchPattern":"watch, err := w.WatchDirectory(dir, cb)\nif err != nil && err.Error() == \"could not get file information\" {\n    // transient: retry with backoff\n    time.Sleep(250 * time.Millisecond)\n    watch, err = w.WatchDirectory(dir, cb)\n}","preventionTips":["Subscribe only when the target directory is confirmed present","Prefer stable local directories over flaky network shares for watch roots","Retry transient metadata failures once or twice before reporting","Watch for filter-driver interference when errors cluster in time"],"tags":["windows","handle","network-share","transient","removable-media"],"backgroundTag":null,"analyzedSha":"1bcfa18d79a3be41772223d5c05dfe4480e614ff","analyzedAt":"2026-08-16T02:12:00.115Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}