{"record":{"id":"ed6612acfecfe31b","repo":"zed-industries/zed","slug":"poll-watcher-initialized","errorCode":null,"errorMessage":"poll watcher initialized","messagePattern":"poll watcher initialized","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/fs/src/fs_watcher.rs","lineNumber":990,"sourceCode":"            .covered_by_recursive_ancestor(&path, self.recursive);\n        let path_already_registered = state.paths.contains(&key);\n\n        if !path_already_covered && !path_already_registered {\n            if self.kind == OsWatcherKind::Native && state.is_native_watch_limit_cooldown_active() {\n                self.diagnostics.record(|| {\n                    WatchDiagnosticEvent::new(\n                        self.kind,\n                        \"watch_skipped\",\n                        &[path.as_path().to_owned()],\n                        \"Native watch limit cooldown is active; registration will be retried\"\n                            .into(),\n                        false,\n                    )\n                });\n                return Ok(None);\n            }\n\n            drop(state);\n            match self.watch(path.as_path()) {\n                Ok(()) => {}\n                Err(error)\n                    if self.kind == OsWatcherKind::Native && is_max_files_watch_error(&error) =>\n                {\n                    self.start_native_watch_limit_cooldown(path.as_path());\n                    return Ok(None);\n                }\n                Err(error) => return Err(error),\n            }\n            state = self.state.lock();\n        }\n\n        let id = state.last_registration;\n        state.last_registration = WatcherRegistrationId(id.0 + 1);\n\n        let registration_state = WatcherRegistrationState {\n            callback: Arc::new(cb),","sourceCodeStart":972,"sourceCodeEnd":1008,"githubUrl":"https://github.com/zed-industries/zed/blob/916fc2b8cb3a815cbef4a3b40e13081be72036b6/crates/fs/src/fs_watcher.rs#L972-L1008","documentation":"The poll-mode counterpart of the native watcher guard: after ensure_poll_watcher() returns Ok, the code re-locks poll_watcher and expects Some('poll watcher initialized'). It fires only if the just-succeeded initialization did not leave a watcher installed — an internal contradiction or an interleaved teardown — since WatcherMode::Poll dispatch reaches this line only after the ensure call succeeded.","triggerScenarios":"Thrown at crates/fs/src/fs_watcher.rs:1015 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Return the initialized watcher reference from ensure_poll_watcher so no second lock/expect is needed","On None, call ensure_poll_watcher again and propagate its error rather than panicking","Guard the ensure/use pair with a single critical section to eliminate the interleaving window"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"916fc2b8cb3a815cbef4a3b40e13081be72036b6","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}