GitHub Actions "mapping values are not allowed in this context"
YAML found a colon where it expected a plain value, usually an unquoted string that itself contains a colon. The file fails to parse.
What this error means
The workflow is rejected with "mapping values are not allowed in this context", pointing at a line that has an unexpected colon.
github-actions
Invalid workflow file: .github/workflows/ci.yml#L13
mapping values are not allowed in this contextCommon causes
An unquoted value containing a colon
A run command or string like time: 5 or a URL with a port (host:8080) is read as a key/value mapping unless quoted.
A duplicate or misplaced colon
Two colons on one line, or a colon after a value that should be a scalar, confuses the parser.
How to fix it
Quote values that contain colons
- Wrap any scalar containing a colon in single or double quotes.
- For multi-line commands use a block scalar with run: |.
.github/workflows/ci.yml
- run: echo "deploying to host:8080"
- name: 'fix: handle colon'
run: |
echo "ratio 2:1"How to prevent it
- Quote any string with a colon, comma, or leading special character.
- Use block scalars (| or >) for multi-line shell snippets.
Related guides
GitHub Actions YAML "did not find expected key"Fix the GitHub Actions YAML error "did not find expected key" caused by broken indentation that leaves the pa…
GitHub Actions "Invalid workflow file: error in your yaml syntax"Fix the GitHub Actions "Invalid workflow file: You have an error in your yaml syntax" message caused by tabs,…
GitHub Actions "every step must define a uses or run key"Fix the GitHub Actions "every step must define a uses or run key" validation error caused by a step that has…