openclaw - ✅(Solved) Fix [Bug]: too many open files [1 pull requests, 2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#75501Fetched 2026-05-02 05:33:49
View on GitHub
Comments
2
Participants
3
Timeline
9
Reactions
3
Author
Timeline (top)
commented ×2cross-referenced ×2labeled ×2mentioned ×1

Bug Report: Skills Watcher causes EMFILE (too many open files) error after recent update

After upgrading to the latest version of OpenClaw, the Skills Watcher crashes immediately on startup with the following error:

skills watcher error (/Users/.../.openclaw/workspace): Error: EMFILE: too many open files, watch

This also causes cascading failures across other components:

  • [tools] exec failed: spawn EBADF — all shell commands fail (git, go, etc.)
  • [telegram][diag] closing stale transport / rebuilding transport — Telegram gateway keeps reconnecting

Root Cause: The Skills Watcher appears to recursively watch the entire workspace directory without filtering out common large directories such as venv, node_modules, log, and cache folders. In my case, the workspace contains ~308,000 files, which exhausts the OS file descriptor limit instantly.

Environment:

  • macOS
  • Workspace file count: ~308,000 files
  • Largest directories: venv (80,000+ files), daily_stock_analysis, quant_system, node_modules

Expected Behavior: The watcher should ignore directories like venv, node_modules, __pycache__, log, and other non-source folders by default, similar to how most file watchers (e.g., Chokidar) handle ignore patterns.

This issue did not exist in the previous version. It appears the new Skills Watcher implementation removed or regressed the ignore/exclude logic.

Suggested Fix: Add default ignore patterns to the watcher, for example:

venv/, node_modules/, __pycache__/, .git/, log/, logs/, dist/, build/, cache/

Or expose a configuration option in openclaw.json so users can define custom ignore paths.

Happy to provide additional logs or debug info if needed. Thanks!

Error Message

skills watcher error (/Users/.../.openclaw/workspace): Error: EMFILE: too many open files, watch

Root Cause

Root Cause: The Skills Watcher appears to recursively watch the entire workspace directory without filtering out common large directories such as venv, node_modules, log, and cache folders. In my case, the workspace contains ~308,000 files, which exhausts the OS file descriptor limit instantly.

Fix Action

Fixed

PR fix notes

PR #75518: fix: [Bug]: too many open files

Description (problem / solution / changelog)

Summary

Fix EMFILE (too many open files) error in Skills Watcher by ensuring directory ignore patterns (node_modules, venv, etc.) are checked BEFORE the directory traversal check, not after.

When chokidar calls the ignored filter function with stats.isDirectory() === true, the original code returned false (do not ignore) immediately, bypassing the DEFAULT_SKILLS_WATCH_IGNORED patterns. This caused directories like node_modules and venv to be traversed, exhausting file descriptors on workspaces with 300k+ files.

Changes

  • Reordered ignore pattern check to execute BEFORE the directory early-return in shouldIgnoreSkillsWatchPath()
  • Now when a directory path matches an ignore pattern, it is properly excluded before chokidar descends into it

Testing

  • All 5 existing tests in refresh.test.ts pass
  • Verified that /workspace/skills/node_modules, /workspace/skills/venv, etc. are now correctly ignored at the directory level

Fixes openclaw/openclaw#75501

Changed files

  • src/agents/skills/refresh.ts (modified, +2/-2)
  • src/auto-reply/reply/source-reply-delivery-mode.test.ts (modified, +53/-0)
  • src/auto-reply/reply/source-reply-delivery-mode.ts (modified, +7/-0)

Code Example

skills watcher error (/Users/.../.openclaw/workspace): Error: EMFILE: too many open files, watch

---

venv/, node_modules/, __pycache__/, .git/, log/, logs/, dist/, build/, cache/

---
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Bug Report: Skills Watcher causes EMFILE (too many open files) error after recent update

After upgrading to the latest version of OpenClaw, the Skills Watcher crashes immediately on startup with the following error:

skills watcher error (/Users/.../.openclaw/workspace): Error: EMFILE: too many open files, watch

This also causes cascading failures across other components:

  • [tools] exec failed: spawn EBADF — all shell commands fail (git, go, etc.)
  • [telegram][diag] closing stale transport / rebuilding transport — Telegram gateway keeps reconnecting

Root Cause: The Skills Watcher appears to recursively watch the entire workspace directory without filtering out common large directories such as venv, node_modules, log, and cache folders. In my case, the workspace contains ~308,000 files, which exhausts the OS file descriptor limit instantly.

Environment:

  • macOS
  • Workspace file count: ~308,000 files
  • Largest directories: venv (80,000+ files), daily_stock_analysis, quant_system, node_modules

Expected Behavior: The watcher should ignore directories like venv, node_modules, __pycache__, log, and other non-source folders by default, similar to how most file watchers (e.g., Chokidar) handle ignore patterns.

This issue did not exist in the previous version. It appears the new Skills Watcher implementation removed or regressed the ignore/exclude logic.

Suggested Fix: Add default ignore patterns to the watcher, for example:

venv/, node_modules/, __pycache__/, .git/, log/, logs/, dist/, build/, cache/

Or expose a configuration option in openclaw.json so users can define custom ignore paths.

Happy to provide additional logs or debug info if needed. Thanks!

Steps to reproduce

Start openclaw 2026.4.29

Expected behavior

Normally Response

Actual behavior

Timeout

OpenClaw version

2026.4.29

Operating system

macOS 15.4

Install method

No response

Model

ALL

Provider / routing chain

Openclaw->kimi

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

Add default ignore patterns to the Skills Watcher to prevent it from recursively watching large directories like venv and node_modules.

Guidance

  • Verify the issue by checking the file count in the workspace directory and the largest directories, such as venv and node_modules.
  • Consider adding a configuration option in openclaw.json to allow users to define custom ignore paths.
  • Test the suggested fix by adding the following ignore patterns: venv/, node_modules/, __pycache__/, .git/, log/, logs/, dist/, build/, cache/.
  • Check if the issue is resolved by restarting the Skills Watcher and verifying that it no longer crashes with an EMFILE error.

Example

// Example ignore patterns
const ignorePatterns = [
  'venv/',
  'node_modules/',
  '__pycache__/',
  '.git/',
  'log/',
  'logs/',
  'dist/',
  'build/',
  'cache/',
];

Notes

The suggested fix assumes that the issue is caused by the Skills Watcher recursively watching large directories. If the issue persists after applying the fix, additional debugging may be necessary.

Recommendation

Apply the workaround by adding default ignore patterns to the Skills Watcher, as this is a regression issue that was introduced in the latest version of OpenClaw.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Normally Response

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING