GitHub Actions environment file too large
The runner imposes a size cap on the environment files. Writing a large blob (a whole file, a big JSON payload) to $GITHUB_ENV or $GITHUB_OUTPUT trips the limit and fails the step.
What this error means
A step writing to an environment file fails with a too-large error.
github-actions
Error: The environment file is too large.
Writing this much data to $GITHUB_ENV / $GITHUB_OUTPUT exceeds the allowed size.Common causes
Large payload into env/output
A step appends a whole file or large variable to $GITHUB_ENV or $GITHUB_OUTPUT.
How to fix it
Pass large data via artifacts or files
- Store large data on disk and reference the path, or upload it as an artifact.
- Only pass small identifiers/paths through environment files.
.github/workflows/ci.yml
- run: |
echo "result_path=${RUNNER_TEMP}/result.json" >> "${GITHUB_OUTPUT}"
cp big.json "${RUNNER_TEMP}/result.json"How to prevent it
- Keep env/output values small (ids, flags, short paths).
- Use artifacts or the filesystem for large blobs.
Related guides
GitHub Actions "step output exceeds max size"Fix the GitHub Actions error where a step writes an output to GITHUB_OUTPUT that exceeds the allowed size.
GitHub Actions Job Outputs Truncated or Dropped at Size LimitFix GitHub Actions job outputs that come through truncated or empty - job and step outputs have a size cap, s…
GitHub Actions "secret too large (64KB limit)"Fix the GitHub Actions error where a secret value exceeds the 64KB size limit.