You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
copy-ignored fails silently with very large trees #1865
I noticed today that I was not getting node_modules copied over correctly when creating new worktrees.
My ~/.config/worktrunk/config.toml only contains the following at the end of the default file:
[post-start]
copy = "wt step copy-ignored"
When I ran wt switch --create, I got what appeared to be a correct worktree and no error messages, but some of my npm packages were not there. These are not git-controlled files.
Next, I ran wt hook post-start -v to debug and got:
This is on macOS 26.4. It's a Rails project with a large seeded storage directory and a sub-project with a very large node_modules directory.
I can probably work around this by scripting a fresh rails db:seed and npm ci as a hook but the bigger issue, I think, is that an error in a low-level step isn't being propagated to the user.
While I think that rewriting the background processes to properly report errors is a bigger issue, #1864 is my effort to address the underlying failure.
Thanks for reporting this (and for the detailed investigation)! I can confirm the root cause from code reading.
File descriptor exhaustion:step_copy_ignored iterates entries with par_iter() on the global rayon pool. Each directory entry calls copy_dir_recursive, which creates its own 4-thread pool. With many directory entries processed in parallel, this spawns many independent thread pools — each holding open file handles — exhausting the OS limit.
Silent failure: When copy-ignored runs as a post-start hook, it's spawned as a detached background process. The parent only checks whether the spawn succeeded, not the command's exit status — so a failure like EMFILE is logged to a file but never shown to the user.
Your #1864 addresses the first concern. CI is currently failing on that PR (lint + test errors) — let us know if you'd like help getting it green. The silent error propagation is a separate issue worth tracking; I'll leave that for a maintainer to evaluate.
Activity
worktrunk-bot commentedon Apr 1, 2026
Thanks for reporting this (and for the detailed investigation)! I can confirm the root cause from code reading.
File descriptor exhaustion:
step_copy_ignorediterates entries withpar_iter()on the global rayon pool. Each directory entry callscopy_dir_recursive, which creates its own 4-thread pool. With many directory entries processed in parallel, this spawns many independent thread pools — each holding open file handles — exhausting the OS limit.Silent failure: When
copy-ignoredruns as a post-start hook, it's spawned as a detached background process. The parent only checks whether the spawn succeeded, not the command's exit status — so a failure like EMFILE is logged to a file but never shown to the user.Your #1864 addresses the first concern. CI is currently failing on that PR (lint + test errors) — let us know if you'd like help getting it green. The silent error propagation is a separate issue worth tracking; I'll leave that for a maintainer to evaluate.
fspeirs commentedon Apr 1, 2026
Linter and test fixes are now in.
worktrunk-bot commentedon Apr 1, 2026
CI is all green now — lint, tests (all platforms), and codecov pass. Thanks for the quick fixes!