Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Watchman crawl failed, recrawl warnings and the poisoned state

Errorjest-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.

  • Applies to Watchman 4.6 or newer, React Native 0.7x, Ubuntu 24.04, macOS 15
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 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 version
  2. 2Match what you see, then jump to its fix

    1. 1Recrawled this watch N time, most recently because: ...A stale recrawl warning is still attached to the watchFix
    2. 2A non-recoverable condition has triggered ... inotify_add_watchinotify limits reached on Linux (poisoned state)Fix
    3. 3Poison: opendir(...) Too many open files in systemThe system is out of open files (opendir: Too many open files in system)Fix

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-list

2Fix

Restart the Watchman server. The next query sets the watch up again.

watchman shutdown-server

3Verify

Start Metro or Jest again and run watchman watch-list: the warning is gone.

npx react-native start

Confirmed by meta.github.io

Did this fix it?

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_events

2Fix

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-server

3Verify

The new limit is active and Watchman no longer reports poison.

cat /proc/sys/fs/inotify/max_user_watches
watchman watch-list

Confirmed by meta.github.io

Did this fix it?

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 | head

2Fix

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-server

3Verify

Watchman starts a watch on the project without a poison warning.

watchman watch-list

Confirmed by meta.github.io

Did this fix it?

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:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.