{"record":{"id":"afb9b7d7591319cc","repo":"vercel/turborepo","slug":"file-watcher-still-initializing-after-s-likely","errorCode":null,"errorMessage":"File watcher still initializing after {}s, likely a large file is slowing the initial hash.{}\\nRetrying...","messagePattern":"File watcher still initializing after (.+?)s, likely a large file is slowing the initial hash\\.(.+?)\\\\nRetrying\\.\\.\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/turborepo-lib/src/run/watch.rs","lineNumber":448,"sourceCode":"        let initial_event = loop {\n            match tokio::time::timeout(STARTUP_ATTEMPT, events.recv()).await {\n                Ok(Ok(event)) => break event,\n                Ok(Err(broadcast::error::RecvError::Closed)) => {\n                    return Err(Error::PackageChangeClosed)\n                }\n                Ok(Err(broadcast::error::RecvError::Lagged(_))) => {\n                    return Err(Error::PackageChangeLagged)\n                }\n                Err(_) => {\n                    if started.elapsed() >= startup_cap {\n                        return Err(Error::FileWatchingTimeout(\n                            startup_cap.as_secs(),\n                            slowest_files_hint(&self._watching.hash_watcher.slowest_files()),\n                        ));\n                    }\n                    if !warned {\n                        warned = true;\n                        turborepo_log::warn(\n                            turborepo_log::Source::turbo(turborepo_log::Subsystem::Run),\n                            format!(\n                                \"File watcher still initializing after {}s, likely a large file \\\n                                 is slowing the initial hash.{}\\nRetrying...\",\n                                STARTUP_ATTEMPT.as_secs(),\n                                slowest_files_hint(&self._watching.hash_watcher.slowest_files())\n                            ),\n                        )\n                        .emit();\n                    }\n                }\n            }\n        };\n\n        let signal_subscriber = self.handler.subscribe().ok_or(Error::NoSignalHandler)?;\n\n        let pending_changes = Mutex::new(ChangedPackages::default());\n        let notify_run = Arc::new(Notify::new());","sourceCodeStart":430,"sourceCodeEnd":466,"githubUrl":"https://github.com/vercel/turborepo/blob/f9245100cf0d31d96628804ead485f6bf226e55a/crates/turborepo-lib/src/run/watch.rs#L430-L466","documentation":"Emitted by `turbo run --watch` while waiting for the file watcher's initial hashing pass to finish. If hashing has not completed after STARTUP_ATTEMPT seconds, turbo logs this warning (once) including a slowest_files_hint from the hash watcher, then keeps retrying until startup_cap elapses, at which point the run fails with Error::FileWatchingTimeout. It indicates large or slow-to-hash files in the watched tree, not a watcher crash. A broadcast lag during watching instead surfaces Error::PackageChangeLagged.","triggerScenarios":"Running `turbo <tasks> --watch` when the initial hash of watched files exceeds STARTUP_ATTEMPT seconds: very large files (binaries, media, bundled assets), directories not excluded by .gitignore, or slow filesystems (network mounts, containers). The warning fires on the Err(_) arm of the watcher readiness select loop before the startup_cap deadline turns into a hard FileWatchingTimeout error.","commonSituations":"Monorepos with committed build artifacts or media; watch runs inside Docker or on NFS; the first watch after cloning a big repo; generated directories that turbo hashes because they are not gitignored.","solutions":["Check the slowest-files hint printed with the warning and add those files/directories to .gitignore (or .turboignore / turbo.json `inputs`) so the watcher skips them","Move or shrink large generated artifacts out of the watched tree","Wait it out: turbo retries automatically and only aborts once startup_cap elapses","Run watch mode on a local filesystem instead of network storage"],"exampleFix":"# before: .gitignore does not exclude heavy artifacts\n# (assets/*.psd hashed at startup, watcher lags)\n\n# after: .gitignore\n*.psd\n*.mp4\ndist-artifacts/","handlingStrategy":"retry","validationCode":"# Before starting watch mode, find files likely to slow the initial hash:\nfind . -type f -size +50M -not -path './node_modules/*' -not -path './.git/*' -not -path '*/.turbo/*'\n# gitignore or move whatever shows up before running `turbo run --watch`","typeGuard":"// Rust (embedding the turbo crates):\nfn is_file_watching_timeout(e: &turborepo_lib::Error) -> bool {\n    matches!(e, turborepo_lib::Error::FileWatchingTimeout(_, _))\n}","tryCatchPattern":"// Rust: surface the slow-file hint, let the operator fix ignores, retry once\nmatch result {\n    Err(Error::FileWatchingTimeout(secs, hint)) => {\n        eprintln!(\"watch startup timed out after {secs}s: {hint}\");\n        // add offenders to .gitignore, then retry the run\n    }\n    Err(Error::PackageChangeLagged) => { /* watcher fell behind; restart watch mode */ }\n    other => other?,\n}","preventionTips":["Keep large binaries and generated artifacts out of the repo (gitignore them) so the watcher never hashes them","Prefer local SSD-backed filesystems for --watch; network mounts drastically slow hashing","Scope task `inputs` in turbo.json so huge directories are not part of the hashed set","Act on the slowest-files hint immediately — after startup_cap the warning becomes a hard FileWatchingTimeout error"],"tags":["watch-mode","file-hashing","performance","turborepo"],"backgroundTag":"file-watcher-timeout","analyzedSha":"f9245100cf0d31d96628804ead485f6bf226e55a","analyzedAt":"2026-08-17T10:46:15.696Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}