Skip to content
Latchkey

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 context

Common 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

  1. Wrap any scalar containing a colon in single or double quotes.
  2. 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

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