Skip to content
Latchkey

GitHub Actions "Unexpected symbol" in a ${{ }} Expression

An expression inside ${{ }} could not be parsed. A string literal is unquoted, an operator is wrong, or a stray character broke the expression grammar.

What this error means

The workflow is invalid with "Unexpected symbol", pointing at a position inside an expression. The YAML is fine; the expression itself does not parse.

Actions annotation
The workflow is not valid. .github/workflows/ci.yml (Line: 10, Col: 11):
Unexpected symbol: '"main'. Located at position 18 within expression: github.ref == "main

Common causes

String literal not single-quoted

Expression string literals use single quotes. Using double quotes, or an unterminated quote, breaks the parser with "Unexpected symbol".

Bad operator or stray character

A typo like = instead of ==, a misplaced brace, or text glued to an expression produces an unparseable symbol.

How to fix it

Quote literals with single quotes

Use single quotes for string literals and the correct comparison operators inside the expression.

.github/workflows/ci.yml
if: ${{ github.ref == 'refs/heads/main' }}

Check braces and operators

  1. Confirm each ${{ has a matching }} and no nested unescaped braces.
  2. Use ==, !=, &&, ||, and functions like contains() - not assignment operators.
  3. Validate expressions with actionlint, which parses the expression grammar.

How to prevent it

  • Single-quote all string literals in expressions.
  • Keep one complete expression per ${{ }} with matching braces.
  • Lint expressions with actionlint, not just the YAML.

Related guides

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