Install
openclaw skills install openclaw-gateway-fd-fixFix OpenClaw Gateway "spawn EBADF" / "RPC probe failed" / "EMFILE too many open files" errors caused by file descriptor exhaustion from too many files in workspace. One-click detection and repair for the most common OpenClaw crash issue.
openclaw skills install openclaw-gateway-fd-fixOpenClaw Gateway crashes or hangs with these errors:
spawn EBADF when running exec commandsRPC probe failed / gateway timeoutEMFILE: too many open files, watchThe Gateway automatically watches all files under ~/.openclaw/workspace/ for changes. If you place virtual environments (.venv), node_modules, large datasets, or tens of thousands of small files inside workspace, the file watcher will exceed macOS's default file descriptor limit (256), causing the process to hang.
Run the one-click repair script:
bash fix.sh
What it does:
.venv, node_modules) inside workspaceIf you prefer to fix manually:
# Never put these inside ~/.openclaw/workspace/:
rm -rf ~/.openclaw/workspace/*/.venv
rm -rf ~/.openclaw/workspace/*/node_modules
# Move datasets/models/venvs to ~/Downloads/ or /tmp/
~/Library/LaunchAgents/ai.openclaw.gateway.plist and add inside the root <dict>:
<key>HardResourceLimits</key>
<dict>
<key>NumberOfFiles</key>
<integer>524288</integer>
</dict>
<key>SoftResourceLimits</key>
<dict>
<key>NumberOfFiles</key>
<integer>524288</integer>
</dict>
launchctl bootout gui/$(id -u) ~/Library/LaunchAgents/ai.openclaw.gateway.plist
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/ai.openclaw.gateway.plist
sleep 10 && openclaw gateway status
✅ Do NOT put these inside ~/.openclaw/workspace/:
.venv, venv)node_modules directories✅ Put these outside workspace: /tmp/, ~/Downloads/, or any directory outside ~/.openclaw/workspace/
After fix, run:
openclaw gateway status
You should see RPC probe: ok in the output.
If fix fails:
tail -50 ~/.openclaw/logs/gateway.err.logfind ~/.openclaw/workspace -type f | wc -l (should be < 1000)openclaw gateway stop && openclaw gateway install