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.
github-actions
/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.
.github/workflows/ci.yml
- 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.
Related guides
GitHub Actions "Argument list too long" from a Large Matrix or CommandFix GitHub Actions "Argument list too long" (E2BIG) - a step passing a huge expanded matrix value or file lis…
GitHub Actions "Process completed with exit code 1" - Locate the Real FailureUnderstand GitHub Actions "Process completed with exit code 1" - a generic non-zero exit from a run step. Fin…
GitHub Actions Pipeline Failure Masked - pipefail Not Set in run:Fix GitHub Actions steps that pass despite a failing command in a pipe - bash run steps set pipefail by defau…