Skip to content
Latchkey

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 == "prod

Common 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

  1. Wrap string literals in single quotes inside expressions.
  2. 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →