[BUG] Cowork: EDEADLK (errno 35) on vault files when --add-dir flag is used — blocks vault read/write across sessions
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?
In Cowork mode, all pre-existing files in a vault directory passed via --add-dir become completely unreadable with EDEADLK (errno 35): Resource deadlock avoided. This blocks the entire memory/context management system since Claude cannot read or update existing vault files.
Impact: P0 Critical — The memory system is fully non-functional because Claude cannot read context files or daily notes that existed before the current session.
What fails:
cat,head,tail,cp,dd— all returnerrno 35- - Python
open()—OSError: [Errno 35] Resource deadlock avoided - - - Claude's Read tool on any pre-existing vault file
What works:
- Creating new files in the vault
- - Reading newly-created files
- - - Listing directories
- - - - Checking file metadata (stat)
- - - - - Acquiring flock on files (but reading fails afterward)
Root cause (confirmed): The --add-dir flag causes the Claude SDK to index vault files during startup, holding internal file handles. These handles conflict with subsequent read operations at the kernel level, triggering EDEADLK. Files in directories NOT passed to --add-dir (e.g., .claude/) are fully accessible even as pre-existing files.
What Should Happen?
All files in a vault directory passed via --add-dir should be fully readable and writable by Claude's tools (Read tool, Bash) and standard system commands across session boundaries.
The --add-dir flag's indexing behavior should not hold file handles that conflict with read operations. Files should be accessible regardless of whether they existed before the current session started.
Error Messages/Logs
Bash:
$ cat "/sessions/brave-peaceful-johnson/mnt/CLAUDE OBSIDIAN VAULT/03 - Context/Context - Josh.md"
cat: error reading: Resource deadlock avoided
$ head "/sessions/brave-peaceful-johnson/mnt/CLAUDE OBSIDIAN VAULT/03 - Context/Context - Josh.md"
head: error reading: Resource deadlock avoided
$ cp "/sessions/brave-peaceful-johnson/mnt/CLAUDE OBSIDIAN VAULT/03 - Context/Context - Josh.md" /tmp/copy.md
cp: error reading: Resource deadlock avoided
Python:
with open("/sessions/brave-peaceful-johnson/mnt/CLAUDE OBSIDIAN VAULT/03 - Context/Context - Josh.md", 'r') as f:
content = f.read()
# OSError: [Errno 35] Resource deadlock avoided
Lock test (flock succeeds but read fails):
fcntl.flock(fd, fcntl.LOCK_SH | fcntl.LOCK_NB) # Success
os.read(fd, 1000) # Errno 35: EDEADLOCK
Mount info:
bindfs on /sessions/brave-peaceful-johnson/mnt/CLAUDE OBSIDIAN VAULT type fuse.bindfs
(rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other)
Key comparison (same fuse.bindfs mount type):
Directory | --add-dir? | File Access
/mnt/CLAUDE OBSIDIAN VAULT | YES | EDEADLK (errno 35)
/mnt/.claude | NO | Works fine
Steps to Reproduce
- Launch Cowork with a folder mounted via
--add-dir(e.g., an Obsidian vault) - 2. Start a Cowork session — vault is accessible and files can be read normally
- 3. Session ends (either normally or via context compaction/continuation)
- 4. Start a new Cowork session with the same
--add-dirvault - 5. Attempt to read any file that existed before the current session:
- ```bash
- cat "/path/to/vault/any-existing-file.md"
- # Result: cat: error reading: Resource deadlock avoided
- ```
- 6. Observe EDEADLK on ALL pre-existing files, while newly-created files work fine
Reproduction rate: 100% on session continuation after context compaction
Key diagnostic: Files in directories NOT passed to --add-dir (same bindfs mount type) are fully readable. Only files in --add-dir directories trigger EDEADLK. This persists even after: closing Obsidian, fresh session restart, moving the vault folder location.
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.41 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗