GitHub Actions "Argument list too long"
The OS caps the total size of a command line plus environment. Passing a huge expanded glob or list of files to a single command crosses that limit and fails with "Argument list too long".
What this error means
A run step fails with "Argument list too long" (E2BIG), typically when a shell glob expands to thousands of files passed to one command like rm, cp, or a linter.
/usr/bin/find: cannot exec: Argument list too long
Error: Process completed with exit code 1.Common causes
Glob expands to too many arguments
A pattern like rm dist/* expands to thousands of paths, exceeding the exec argument-size limit.
Oversized environment plus args
A large environment combined with a long argument list pushes the total over the limit.
How to fix it
Stream arguments instead of expanding inline
- Use find ... -exec or pipe into xargs to chunk arguments.
- Operate on a directory rather than expanding its contents.
- Reduce environment bloat where possible.
- run: find dist -type f -name '*.log' -print0 | xargs -0 rm -fHow to prevent it
- Pipe large file lists through xargs rather than inline globs.
- Prefer directory-level operations over expanding every file.
- Keep the environment lean on file-heavy steps.