GitHub Actions unexpected symbol in a ${{ }} expression
GitHub Actions unexpected symbol in a ${{ }} expression means the expression parser reached a character it has no rule for and stopped. The YAML is fine, the workflow never starts, and the message hands you the offending token, its position and the expression it came from, which is usually enough to fix it without running anything. Four fields in one line. The file position points at the YAML…
GitHub Actions generates an unexpected symbol error when a ${{ }} expression contains a character it cannot parse. The YAML file is correct, the workflow never starts, and the message provides the exact offending token, its position, and the expression it originated from. This information is usually sufficient to fix the issue without executing any code.
The error message contains four key pieces of data: the file name and line/column of the YAML key holding the expression, the type of problem, the raw token that caused the parser to stop, and a position within the expression along with the expression itself. The position is an index into the expression, not the file.
Common causes include using double quotes for string literals (single quotes are required), encountering an operator not present in the expression language (such as `&`, `|`, `=`, or a ternary), having a stray or mismatched brace, or concatenating literal text directly within an expression. The parser often points to the dangling punctuation, which can be misleading if readers assume the error is farther along in the file.
To resolve the error, replace double quotes with single quotes for string literals, escape single quotes with two single quotes, and avoid using operators or syntax not supported by the expression language. Instead, use logical operators like `&&` and `||`, and functions such as `contains()`, `startsWith()`, or `format()`. If the logic requires arithmetic or branching, move it to a `run:` step and read the result as a step output.
Linting tools like `actionlint` can catch these errors during commits rather than on pushes, preventing invalid workflows from being pushed to the default branch. Preventive measures include single-quoting every string literal inside an expression, keeping one expression per `${{ }}` block, and using `actionlint` in pre-commit hooks.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.