[Bug]: Running Claude Code in a container crashes apps on the host system with "too many open files"
- Dominant language
- Swift
- Stars
- 49.9k
- Forks
- 1.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 22
Description
### I have done the following
- [x] I have searched the existing issues
- [ ] If possible, I've reproduced the issue using the 'main' branch of this project
### Steps to reproduce
https://github.com/emarc/claude-contained implements a containerized version of Claude Code (and other AI tools). It works by sharing the current folder with Claude Code running in a container.
Run that on any folder with many files (tried with https://github.com/vaadin/flow) and ask Claude to do just about anything related to files (e.g. "What files are there").
### Current behavior
It will start consuming file descriptors as it iterates through files. Quite quickly you will have tens or hundreds of thousands of file descriptors in use when the project contains e.g. a `node_modules` folder. Then you will quite quickly reach the Mac OS file system limit and applications inside or outside the container will start crashing.
### Expected behavior
It closes file descriptors after they have been used
### Environment
```markdown
- OS: macOS Tahoe 26.2 (25C56)
- Xcode:
- Container: container CLI version 0.8.0 (build: release, commit: a18df81)
```
### Relevant log output
```shell
N/A
```
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Assessment
This issue has not been assessed yet.