GitHub Actions fromJSON "Unexpected end of JSON input"
fromJSON parses its argument as JSON. An empty output, a truncated multiline value, or an unset variable yields an empty string, which is not valid JSON and fails to parse.
What this error means
A matrix or value built with fromJSON fails at evaluation time, usually because the source step output was empty or got cut off.
github-actions
Error: Unexpected end of JSON input while parsing ''Common causes
Source output is empty
The step that should produce JSON wrote nothing to GITHUB_OUTPUT, so fromJSON gets an empty string.
Multiline JSON output truncated
Writing multiline JSON to GITHUB_OUTPUT without a heredoc delimiter truncates it.
How to fix it
Emit valid, complete JSON
- Confirm the producing step prints non-empty JSON and writes it to GITHUB_OUTPUT.
- For multiline JSON, use a heredoc delimiter when writing to GITHUB_OUTPUT.
- Guard with a default like fromJSON(steps.gen.outputs.json || '[]').
.github/workflows/ci.yml
- id: gen
run: |
{
echo 'json<<EOF'
cat matrix.json
echo 'EOF'
} >> "${GITHUB_OUTPUT}"How to prevent it
- Always validate that the JSON-producing step emits non-empty output.
- Use heredoc delimiters for any multiline GITHUB_OUTPUT value.
Related guides
GitHub Actions multiline GITHUB_OUTPUT broken without heredocFix a GitHub Actions multiline step output that is truncated - multiline GITHUB_OUTPUT values need a heredoc…
GitHub Actions "The expression is too long (max 21000 characters)"Fix the GitHub Actions "expression is too long (max 21000 chars)" error - a single \${{ }} template exceeds t…
GitHub Actions matrix include creates an unexpected combinationFix a GitHub Actions matrix where include adds or alters combinations unexpectedly - include both extends and…