zed-industries/zed · error

watch registered

Error message

watch registered

What it means

This is not an error but a diagnostic trace log emitted by the filesystem watcher test suite when a watch registration is confirmed. It fires inside the recording test watcher (recording_watcher) after a directory such as /repo/a or /repo/b has been successfully added via the FakeWatchBackend, letting tests assert which paths were actually registered and in what order.

Source

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

        notify::Event {
            paths: vec![PathBuf::from(path)],
            ..notify::Event::new(EventKind::Modify(notify::event::ModifyKind::Any))
        }
    }

    fn recording_watcher() -> (OsWatcher, Arc<Mutex<Vec<String>>>) {
        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()));
        for dir in ["/repo/a", "/repo/a/nested", "/repo/b"] {
            let fired = fired.clone();
            let label = dir.to_owned();
            watcher
                .add(Arc::<Path>::from(Path::new(dir)), false, move |_| {
                    fired.lock().push(label.clone());
                })
                .expect("add watch")
                .expect("watch registered");
        }
        (watcher, fired)
    }

    #[test]
    fn event_dispatches_only_to_registrations_covering_its_path() {
        let (watcher, fired) = recording_watcher();

        watcher.dispatch(Ok(modify_event("/repo/a/file.txt")));

        // Only the directory containing the file resolves; siblings stay untouched.
        assert_eq!(*fired.lock(), vec!["/repo/a".to_owned()]);
    }

    #[test]
    fn event_dispatches_to_every_ancestor_registration() {
        let (watcher, fired) = recording_watcher();

View on GitHub (pinned to 9d272b0363)

Solutions

  1. No fix required; this log confirms successful watch registration in tests
  2. If seen unexpectedly in production, verify the path exists and permissions allow adding a native watch
  3. Check that the watcher backend was constructed before this log appears
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at crates/fs/src/fs_watcher.rs:1539 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/c30a23ccb9f19e03. Report an issue: GitHub.