GitHub Actions GITHUB_ENV heredoc delimiter appears in the value
The heredoc delimiter you used to write a multiline value to GITHUB_ENV also occurs inside the content, so the runner closes the block early and the rest of the value leaks as malformed lines.
What this error means
A multiline GITHUB_ENV write fails or yields a truncated variable because the chosen delimiter collided with the value.
github-actions
Error: Unable to process file command 'env' successfully.
Error: Matching delimiter not found 'EOF'Common causes
Common delimiter inside the value
A predictable delimiter like EOF appears in logs or text being written, so the heredoc closes at the wrong place.
How to fix it
Use a random, unguessable delimiter
- Generate a unique delimiter per write and reuse it for open and close.
- Ensure the delimiter cannot appear in the content.
- Re-run.
.github/workflows/ci.yml
- run: |
DELIM="EOF_$(openssl rand -hex 8)"
{
echo "BODY<<${DELIM}"
cat report.txt
echo "${DELIM}"
} >> "${GITHUB_ENV}"How to prevent it
- Always randomize heredoc delimiters when the content is untrusted.
- Never use a static EOF for values derived from logs or user input.
Related guides
GitHub Actions env var with a newline breaks GITHUB_ENV parsingFix the GitHub Actions error where writing a multiline value to GITHUB_ENV with a single-line syntax corrupts…
GitHub Actions multiline output to GITHUB_OUTPUT without a delimiterFix the GitHub Actions error where a multiline step output written to GITHUB_OUTPUT with NAME=value syntax fa…
GitHub Actions run step "syntax error near unexpected token"Fix the GitHub Actions run-step error "syntax error near unexpected token" in a multiline run block - usually…