Skip to content
Latchkey

GitHub Actions "Can't add a heredoc delimiter that appears in the value"

The heredoc delimiter used for multiline GITHUB_OUTPUT/GITHUB_ENV must not occur anywhere inside the value. If it does, the parser ends the value early and the file command fails.

What this error means

A step writing a multiline output fails because the chosen delimiter (often EOF) appears inside the content, so the value is truncated or the command errors with a delimiter problem.

github-actions
Error: Unable to process file command 'output' successfully.
Error: Matching delimiter not found 'EOF'

Common causes

Delimiter collides with content

The value contains the same token used as the heredoc delimiter, so the parser closes the block prematurely.

Predictable delimiter on arbitrary data

Using a fixed EOF on untrusted/generated content risks the data containing EOF.

How to fix it

Use a random, unique delimiter

  1. Generate a random delimiter per write.
  2. Confirm the value cannot contain that random token.
  3. Write the value between the random open and close markers.
.github/workflows/ci.yml
- run: |
    EOF=$(uuidgen)
    {
      echo "result<<$EOF"
      cat report.txt
      echo "$EOF"
    } >> "${GITHUB_OUTPUT}"

How to prevent it

  • Use a randomly generated heredoc delimiter for multiline outputs.
  • Never reuse a fixed delimiter on arbitrary content.
  • Validate that generated data cannot contain the delimiter.

Related guides

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