Watchman crawl failed, recrawl warnings and the poisoned state
jest-haste-map: Watchman crawl failed. Retrying once with node crawler.Short answer
Metro and Jest fall back to their own slow crawler when Watchman is in trouble. Watchman has three states worth telling apart: a stale recrawl warning, a poisoned state after hitting an inotify limit, and a poisoned state after the system ran out of file descriptors. Read what Watchman reports, then reset it.
Fix it fast
1Find out which cause you have
Ask Watchman what it thinks of the watches. Then start Metro or Jest again and read what Watchman prints.
watchman watch-list && watchman version2Match what you see, then jump to its fix
- 1
Recrawled this watch N time, most recently because: ...A stale recrawl warning is still attached to the watchFix - 2
A non-recoverable condition has triggered ... inotify_add_watchinotify limits reached on Linux (poisoned state)Fix - 3
Poison: opendir(...) Too many open files in systemThe system is out of open files (opendir: Too many open files in system)Fix
- 1
What does the error look like?
jest-haste-map: Watchman crawl failed. Retrying once with node crawler.Recrawled this watch 1 time, most recently because:A non-recoverable condition has triggered. Watchman needs your help!
Cause 1 of 3
A stale recrawl warning is still attached to the watch
1Check
A recrawl happens when Watchman thinks it lost sync with the filesystem. The warning stays until the watch is cancelled and set up again, or the process restarts.
watchman watch-list2Fix
Restart the Watchman server. The next query sets the watch up again.
watchman shutdown-server3Verify
Start Metro or Jest again and run watchman watch-list: the warning is gone.
npx react-native startConfirmed by meta.github.io
Cause 2 of 3
inotify limits reached on Linux (poisoned state)
1Check
On Linux the user limit on inotify watches, or the kernel memory for them, ran out. Watchman documents max_user_watches, max_user_instances and max_queued_events as the limits that matter.
cat /proc/sys/fs/inotify/max_user_watches
cat /proc/sys/fs/inotify/max_user_instances
cat /proc/sys/fs/inotify/max_queued_events2Fix
Raise the limits for your machine, then clear the poisoned state. In Watchman 4.6 and newer, clear it with the two commands below. React Native's troubleshooting page uses a sysctl entry for max_user_watches.
echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
watchman watch-del-all
watchman shutdown-server3Verify
The new limit is active and Watchman no longer reports poison.
cat /proc/sys/fs/inotify/max_user_watches
watchman watch-listConfirmed by meta.github.io
Cause 3 of 3
The system is out of open files (opendir: Too many open files in system)
1Check
This is a system-wide descriptor problem, usually a runaway process, not something wrong with your watch.
sudo lsof | awk '{print $1}' | sort | uniq -c | sort -rn | head2Fix
Stop or fix the process holding the descriptors, then reset Watchman the same way. Raise the system limit only if no runaway process exists.
watchman watch-del-all
watchman shutdown-server3Verify
Watchman starts a watch on the project without a poison warning.
watchman watch-listConfirmed by meta.github.io
How do I stop it coming back?
- Size the inotify limits for the number of project folders you watch, as Watchman's install notes advise.
- Restart Watchman after large branch switches that touch many files.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- TaskvareA task and project-management suite: React on the web, Flutter on mobile, TypeScript underneath.
Related fixes
Mobile apps
Android build stops at processDebugManifest in a React Native app
Manifest merger failed
processDebugManifest is the step that merges your AndroidManifest.xml with the manifests of every library.
2 causes, each with a fixMobile apps
Running pod on a React Native project fails with can't find gem cocoapods
can't find gem cocoapods (>= 0.a) with executable pod
The pod command exists, but the Ruby that is running it has no CocoaPods gem.
3 causes, each with a fixMobile apps
React Native Android build cannot find the foojay-resolver-convention plugin
Plugin [id: 'org.gradle.toolchains.foojay-resolver-convention'] was not found in any of the following sources:
The foojay plugin is a settings plugin that Gradle downloads from the Plugin Portal.
3 causes, each with a fixMobile apps
Kotlin and Java compile to different JVM targets in a React Native Android build
'compileJava' task (current target is 1.8) and 'compileKotlin' task (current target is 11)
Gradle refuses to build when the Java task and the Kotlin task target different JVM versions.
3 causes, each with a fixMobile apps
Gradle cannot run node in a React Native Android build
Process 'command 'node'' finished with non-zero exit value 1
The React Native Gradle plugin starts node for bundling.
3 causes, each with a fixMobile apps
The Android emulator opens the app but never connects to Metro or Expo
Metro bundler ECONNREFUSED 127.0.0.1:19001
When the emulator cannot reach Metro, first prove each side on its own: adb sees the emulator, and Metro listens on its port.
4 causes, each with a fix