{"record":{"id":"0d0da406c3bad2a2","repo":"getzola/zola","slug":"can-t-watch-entry-os-file-watch-limit-reached","errorCode":null,"errorMessage":"Can't watch `{entry}`: OS file watch limit reached. Check how to raise it for your OS.","messagePattern":"Can't watch `(.+?)`: OS file watch limit reached\\. Check how to raise it for your OS\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/serve.rs","lineNumber":613,"sourceCode":"    //   - the path is mandatory but does not exist (eg. config.toml)\n    //   - the path exists but has incorrect permissions\n    // watchers will contain the paths we're actually watching\n    let mut watchers = Vec::new();\n    for (entry, watch_mode, recursive_mode) in watch_this {\n        let watch_path = root_dir.join(entry);\n        let should_watch = match watch_mode {\n            WatchMode::Required => true,\n            WatchMode::Optional => watch_path.exists(),\n            WatchMode::Condition(b) => b && watch_path.exists(),\n        };\n        if should_watch {\n            debouncer\n                .watch(root_dir.join(entry), recursive_mode)\n                .map_err(|e| {\n                    match e.kind {\n                        ErrorKind::MaxFilesWatch => {\n                            // https://github.com/getzola/zola/issues/1803\n                            anyhow!(\"Can't watch `{entry}`: OS file watch limit reached. Check how to raise it for your OS.\")\n                        }\n                        _ => anyhow!(\"Can't watch `{entry}` for changes in folder `{}`. Does it exist, and do you have correct permissions?\", root_dir.display())\n                    }\n                })?;\n            watchers.push(entry.to_string());\n        }\n    }\n\n    let output_path = site.output_path.clone();\n    create_directory(&output_path)?;\n\n    // static_root needs to be canonicalized because we do the same for the http server.\n    let static_root = std::fs::canonicalize(&output_path).unwrap();\n\n    // Create broadcast channel for WebSocket live reload\n    let (reload_tx, _) = broadcast::channel::<String>(100);\n    let broadcaster = reload_tx.clone();\n","sourceCodeStart":595,"sourceCodeEnd":631,"githubUrl":"https://github.com/getzola/zola/blob/61d30828217957120309db657950224edf9707e2/src/cmd/serve.rs#L595-L631","documentation":"The serve command registers filesystem watchers via the notify debouncer; when the OS reports ErrorKind::MaxFilesWatch, it is converted into this error explaining that the OS inotify/watch limit is exhausted. This is deliberate so users get an actionable message instead of a generic watch failure.","triggerScenarios":"zola serve on a large project (or when many other apps consume watches) where the number of files/directories to watch exceeds the OS limit — inotify max_user_watches on Linux is the typical case.","commonSituations":"Linux kernel default fs.inotify.max_user_watches=8192 with a big site or node_modules in the watched tree; running many watchers concurrently (editors, other dev servers) exhausting the user quota; containers with tight inotify limits.","solutions":["Raise the Linux inotify limit: sudo sysctl fs.inotify.max_user_watches=524288 and persist it in /etc/sysctl.conf","Reduce the watched surface: ignore or exclude large generated directories (node_modules, public/) from the project","Close other applications consuming inotify watches (editors, other dev servers)","On containers/WSL, increase inotify limits for the VM or use a native filesystem rather than a bind mount"],"exampleFix":"// before\n$ zola serve\n// Can't watch `...`: OS file watch limit reached.\n// after\n$ sudo sysctl fs.inotify.max_user_watches=524288\n$ zola serve","handlingStrategy":"validation","validationCode":"// Check current inotify watch quota on Linux before serving:\n// cat /proc/sys/fs/inotify/max_user_watches\n// count usage: find ~/project -type d | wc -l","typeGuard":null,"tryCatchPattern":"// shell\nzola serve || {\n  case \"$?\" in\n    1) sudo sysctl fs.inotify.max_user_watches=524288 && zola serve ;;\n  esac\n}","preventionTips":["Raise fs.inotify.max_user_watches persistently on dev machines","Keep node_modules and build output out of the watched project tree","Minimize concurrent watchers (editors, other dev servers) during zola serve"],"tags":["rust","filesystem","inotify","watch-limit"],"backgroundTag":"file-watch-limit-reached","analyzedSha":"61d30828217957120309db657950224edf9707e2","analyzedAt":"2026-09-03T14:39:09.727Z","contentChangedAt":"2026-09-03T14:39:09.727Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}