Skip to content
Latchkey

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

  1. Store large data on disk and reference the path, or upload it as an artifact.
  2. 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →