GitHub Actions "Unexpected symbol" in a ${{ }} expression
The expression parser hit a character it does not understand inside a ${{ }} block, usually a bad operator or an unquoted literal.
What this error means
The workflow is rejected with "Unexpected symbol" and the position within the expression.
github-actions
The workflow is not valid. .github/workflows/ci.yml (Line: 9): Unexpected symbol: '"prod'. Located at position 12 within expression: github.ref == "prodCommon causes
Unterminated or unquoted string
String literals inside expressions use single quotes; a missing closing quote or double quotes inside YAML can break parsing.
Unsupported operator
Operators like += or & are not valid; expressions support ==, !=, &&, ||, !, and comparisons.
How to fix it
Use single-quoted literals and valid operators
- Wrap string literals in single quotes inside expressions.
- Use && and || for logic, not & or |.
.github/workflows/ci.yml
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}How to prevent it
- Keep expressions simple; move complex logic to a run step.
- Run actionlint to validate expression syntax.
Related guides
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 "The template is not valid" expression evaluation errorFix the GitHub Actions "The template is not valid" runtime expression evaluation error caused by a function o…
GitHub Actions "Unrecognized function" in an expressionFix the GitHub Actions expression error "Unrecognized function" caused by calling a function that does not ex…