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
- Generate a random delimiter per write.
- Confirm the value cannot contain that random token.
- 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
GitHub Actions Multiline GITHUB_OUTPUT / GITHUB_ENV "Invalid format"Fix GitHub Actions "Invalid format" writing multiline values to GITHUB_OUTPUT or GITHUB_ENV - multiline conte…
GitHub Actions "Unable to process file command env" (multiline secret to GITHUB_ENV)Fix GitHub Actions "Unable to process file command 'env'" - a multiline value (often a secret) was written to…
GitHub Actions Heredoc in a run: Step Breaks or Expands VariablesFix GitHub Actions heredocs in run: steps - a quoted vs unquoted delimiter changes variable expansion, and in…