{"record":{"id":"c255edeb9f682d5f","repo":"jdx/mise","slug":"no-watch-could-be-installed-for-the-tracked-set","errorCode":null,"errorMessage":"no watch could be installed for the tracked set","messagePattern":"no watch could be installed for the tracked set","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/watch/runtime.rs","lineNumber":1442,"sourceCode":"            Err(err) => {\n                let message = format!(\n                    \"cannot watch {}: {err}; reconciliation still saves it\",\n                    display_path(&anchor.path)\n                );\n                capture.health.watcher.degraded.push(message.clone());\n                capture.out.emit(\n                    \"degraded\",\n                    &message,\n                    json!({ \"path\": display_path(&anchor.path), \"message\": err.to_string() }),\n                );\n            }\n        }\n    }\n    // nothing watched while something should be: no event would ever\n    // arrive, so the caller stops (and the service restarts it) instead of\n    // running blind until a reconciliation that may be disabled\n    if current.is_empty() && !wanted.is_empty() {\n        bail!(\"no watch could be installed for the tracked set\");\n    }\n    capture.anchor_ids = current\n        .iter()\n        .filter_map(|anchor| {\n            file_id::get_file_id(&anchor.path)\n                .ok()\n                .map(|id| (anchor.path.clone(), id))\n        })\n        .collect();\n    Ok(current)\n}\n\nfn anchor_replaced(\n    ids: &std::collections::BTreeMap<PathBuf, file_id::FileId>,\n    path: &Path,\n) -> bool {\n    ids.get(path)\n        .is_some_and(|before| file_id::get_file_id(path).ok().as_ref() != Some(before))","sourceCodeStart":1424,"sourceCodeEnd":1460,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/history/watch/runtime.rs#L1424-L1460","documentation":"After attempting to install watches for all anchors, install checks that at least one watch succeeded while something wanted watching. If none could be installed, no event would ever arrive, so it fails fast instead of running blind; the service layer restarts the watcher later.","triggerScenarios":"install (called by run/reinstall) ends with `current.is_empty() && !wanted.is_empty()` — every debouncer.watch() call failed (e.g. all MaxFilesWatch after a partial install, paths deleted, or permission errors) while anchors were requested.","commonSituations":"System-wide watch exhaustion combined with transient anchor deletion; watched paths on network mounts that don't support inotify; every anchor directory removed while tracked.","solutions":["Check that the anchor paths still exist and are real directories tracked under home/config.","Raise OS watch limits (fs.inotify.max_user_watches on Linux) if watches failed for MaxFilesWatch.","Restart the history watcher service after fixing conditions; it retries installation.","Ensure watched paths are not on network/unsupported filesystems (NFS, some FUSE mounts)."],"exampleFix":"// before: anchor directory removed but still tracked\nrm -rf ~/config-dir\n// after: recreate or untrack it\nmkdir -p ~/config-dir && mise history track ~/config-dir","handlingStrategy":"retry","validationCode":"// verify at least one anchor exists before installing\nif wanted.iter().all(|a| !a.path.exists()) { eprintln!(\"no watchable anchors exist\"); return; }","typeGuard":null,"tryCatchPattern":"loop {\n  match install_watches() {\n    Ok(()) => break,\n    Err(e) if e.to_string().contains(\"no watch could be installed\") => { fix_conditions(); sleep(BACKOFF); }\n    Err(e) => return Err(e),\n  }\n}","preventionTips":["Ensure tracked anchor directories exist and are on local filesystems.","Raise OS watch limits before growing the tracked set.","Let the supervisor/service restart the watcher rather than running unsupervised."],"tags":["filesystem","watch","inotify"],"backgroundTag":"resource-limit-exceeded","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}