GitHub Actions "The template is not valid" expression evaluation error
An expression parsed at load time but failed when evaluated at runtime, for example a fromJSON over invalid data or a format with a bad index.
What this error means
A job fails with "The template is not valid" and an evaluation error describing the failing expression.
github-actions
Error: The template is not valid. .github/workflows/ci.yml (Line: 22): Error while evaluating expression: fromJSON(steps.x.outputs.data)Common causes
fromJSON over invalid JSON
If the upstream output is not valid JSON, fromJSON throws at evaluation time.
format placeholder out of range
A format string referencing {2} with only two arguments fails when evaluated.
How to fix it
Validate inputs before the expression evaluates
- Ensure outputs feeding fromJSON are valid JSON strings.
- Match every format placeholder to a supplied argument.
.github/workflows/ci.yml
- id: x
run: echo 'data=["a","b"]' >> "$GITHUB_OUTPUT"
- run: echo ${{ join(fromJSON(steps.x.outputs.data), ',') }}How to prevent it
- Emit and validate JSON outputs before consuming them.
- Keep expressions short and test them on a branch first.
Related guides
GitHub Actions fromJSON parse errorFix the GitHub Actions fromJSON parse error caused by passing a non-JSON or malformed string into the fromJSO…
GitHub Actions "Context access might be invalid" (actionlint)Fix the actionlint warning "Context access might be invalid" for GitHub Actions caused by referencing a secre…
GitHub Actions "Unexpected symbol" in a ${{ }} expressionFix the GitHub Actions "Unexpected symbol" expression error caused by invalid operators, stray characters, or…