zed-industries/zed · error

add watch

Error message

add watch

What it means

Trace log from the Windows-specific fs_watcher test event_dispatches_when_reported_path_has_verbatim_prefix, recorded when a watch is added. It confirms registration of a directory without the \\?\ verbatim prefix, so the test can assert that a change event reported by notify/Windows using the \\?\ long-path form still dispatches to the callback for the non-verbatim registered path.

Source

Thrown at crates/fs/src/fs_watcher.rs:1776

    #[test]
    #[cfg(target_os = "windows")]
    fn event_dispatches_when_reported_path_has_verbatim_prefix() {
        // `notify` (and Windows APIs generally) can report a changed path using the
        // verbatim `\\?\` long-path form even when the directory was registered
        // without it.
        let backend = Arc::new(Mutex::new(FakeWatchBackend::default()));
        let watcher = test_os_watcher(OsWatcherKind::Native, Some(backend));
        let fired = Arc::new(Mutex::new(Vec::new()));
        {
            let fired = fired.clone();
            watcher
                .add(
                    Arc::<Path>::from(Path::new("C:\\repo\\src")),
                    false,
                    move |_| fired.lock().push(()),
                )
                .expect("add watch")
                .expect("watch registered");
        }

        watcher.dispatch(Ok(modify_event("\\\\?\\C:\\repo\\src\\main.rs")));

        assert_eq!(fired.lock().len(), 1);
    }

    #[test]
    fn test_coalesce_pending_rescans() {
        let test_cases = [
            TestCase {
                name: "coalesces descendant rescans under pending ancestor",
                pending_paths: vec![rescan("/root")],
                path_events: vec![rescan("/root/child"), rescan("/root/child/grandchild")],
                expected_pending_paths: vec![rescan("/root")],
                expected_path_events: vec![],
            },

View on GitHub (pinned to 9d272b0363)

Solutions

  1. No fix required; the log indicates the watch was added successfully
  2. If events are missed on Windows, strip the \\?\ verbatim prefix from reported paths before matching against registered watches
  3. Ensure long paths are handled consistently between registration and event reporting
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/fs/src/fs_watcher.rs:1776 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-09-12). Data as JSON: /api/errors/86028d23715acc27. Report an issue: GitHub.