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 == "mainCommon 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
- Confirm each ${{ has a matching }} and no nested unescaped braces.
- Use ==, !=, &&, ||, and functions like contains() - not assignment operators.
- 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
GitHub Actions "Unrecognized named-value: 'secrets'" Where UnavailableFix GitHub Actions "Unrecognized named-value: `secrets`" - using the secrets context in runs-on, a service im…
GitHub Actions "Unexpected value 'X'" - Wrong Scalar in a Mapping KeyFix GitHub Actions "Unexpected value `X`" - a scalar supplied where a mapping or list is expected, or a value…
GitHub Actions fromJSON Errors - Invalid JSON in a Dynamic MatrixFix GitHub Actions fromJSON failures - passing a non-JSON string, an empty output, or unquoted output to from…