[BUG] File watching error on startup: `EINVAL` when watching `.claude` directory

Resolved 💬 3 comments Opened Jan 16, 2026 by harshakmohan Closed Jan 20, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Claude Code throws unhandled promise rejection errors during startup when attempting to watch the .claude configuration directory and settings.local.json file. The errors are non-fatal (Claude Code continues to run), but may affect settings hot-reloading functionality and creates console spam on every startup.

What Should Happen?

File watching should initialize without errors, or errors should be caught and handled gracefully with appropriate error messages. Claude Code should either:

  1. Successfully watch the .claude directory for configuration changes, OR
  2. Gracefully handle the watch failure with a caught exception and user-friendly warning

Error Messages/Logs

This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
  Error: EINVAL: invalid argument, watch '/home/sidney/Documents/yam-driver/.claude'
      at watch (unknown)
      at new FSWatcher (node:fs:30:31)
      at watch (node:fs:300:23)
      at AGL (/$bunfs/root/claude:161:12986)
      at plB (/$bunfs/root/claude:161:18199)
      at _watchWithNodeFs (/$bunfs/root/claude:161:13467)
      at _handleDir (/$bunfs/root/claude:161:16208)
      at async _addToNodeFs (/$bunfs/root/claude:161:16793)
      at async <anonymous> (/$bunfs/root/claude:161:26215)
      at processTicksAndRejections (native:7:39)

  This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
  Error: EINVAL: invalid argument, watch '/home/sidney/Documents/yam-driver/.claude/settings.local.json'
      at watch (unknown)
      at new FSWatcher (node:fs:30:31)
      at watch (node:fs:300:23)
      at AGL (/$bunfs/root/claude:161:12986)
      at plB (/$bunfs/root/claude:161:18199)
      at _watchWithNodeFs (/$bunfs/root/claude:161:13467)
      at _handleFile (/$bunfs/root/claude:161:14210)
      at _addToNodeFs (/$bunfs/root/claude:161:17237)
      at processTicksAndRejections (native:7:39)

Steps to Reproduce

  1. Have an existing project directory with .claude/settings.local.json created from a previous Claude Code session
  2. Navigate to the project directory: cd /home/sidney/Documents/repo
  3. Run claude command to start Claude Code
  4. Observe the error messages printed to console on startup
  5. Claude Code continues to run normally despite the errors

File system state when error occurs:
$ ls -la .claude/
total 12
drwxrwxr-x 2 sidney sidney 4096 Jan 9 18:25 .
drwxrwxr-x 11 sidney sidney 4096 Jan 13 19:24 ..
-rw-rw-r-- 1 sidney sidney 89 Jan 9 18:25 settings.local.json

$ cat .claude/settings.local.json
{
"permissions": {
"allow": [
"Bash(tree:*)",
"Bash(wc:*)"
]
}
}

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.9

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Terminal.app (macOS)

Additional Information

File system checks performed:

  • Directory and file permissions are normal (0664)
  • No broken symlinks
  • Filesystem is healthy ext4 with no corruption
  • inotify watch limit is 65536 with only 67 active watches (no exhaustion)

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗