Desktop app: parallel Bash tool writes can silently lose files
Description
When the Claude Desktop app executes multiple parallel Bash tool calls that each write files via heredoc (cat > file << 'EOF'), the files can appear to exist (verified by ls -la in the same shell) but silently vanish before the next tool call.
Steps to Reproduce
- In the Claude Desktop app (macOS), send a message that triggers 3+ parallel Bash tool calls
- Each Bash call writes a file via
cat > /path/to/file << 'EOF' ... EOF - Each Bash call verifies with
ls -la— all report success with correct file sizes and timestamps - In a subsequent tool call, check the files — some or all are missing
Observed Behaviour
- 3 files written in parallel Bash calls: all 3 vanished after reporting success
- 1 file written in a separate sequential Bash call to the same filesystem area: survived
- On recreation using sequential writes, all files persisted correctly
- The
ls -laverification within the same Bash process that wrote the file always passes — the file is visible to the kernel buffer but not flushed to disk before the process context is torn down
Expected Behaviour
Files written via parallel Bash tool calls should persist to disk reliably, same as sequential writes.
Environment
- Claude Desktop app (macOS, Sequoia 15.4)
- Apple Silicon (M-series)
- APFS filesystem
- Claude Code version 2.1.85
- Model: Claude Opus 4.6 (1M context)
Workaround
Write critical files sequentially (chained with && in a single Bash call, or one file per tool call). Verify persistence with a separate Bash tool call, not the same one that performed the write.
Additional Context
This may be related to how the Electron process wrapper manages child process lifecycle — specifically, process cleanup may occur before the OS filesystem write buffer is fully flushed. The issue does not appear to affect sequential writes or the CLI version of Claude Code.
This has caused real data loss in production use (knowledge base files, skill configurations). The silent nature of the failure (verification passes, file disappears later) makes it particularly dangerous.
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗