Skip to content
Latchkey

GitHub Actions "mapping values are not allowed in this context" in CI

The YAML parser hit a colon where it expected a plain scalar, so it tried to start a new key inside a value that was not a mapping. An unquoted value containing a colon, or a misindented line, is the usual trigger.

What this error means

The run fails before any job starts with "Invalid workflow file" and a parser line reading "mapping values are not allowed in this context" pointing at a specific line and column.

GitHub Actions
Invalid workflow file: .github/workflows/ci.yml
(Line: 14, Col: 16): while scanning a simple key
mapping values are not allowed in this context

Common causes

An unquoted value contains a colon

A value like run: echo time: 10:00 or a name: containing : is read as a nested mapping, because YAML treats : as a key/value separator.

A line is indented under the wrong parent

A misindented key lands inside a scalar value, so the parser sees a mapping where a plain string was expected.

How to fix it

Quote any value that contains a colon

  1. Find the line and column the parser names.
  2. Wrap the value in single or double quotes so the colon is part of the string.
  3. Re-run the workflow to confirm it parses.
.github/workflows/ci.yml
# wrong: the colon after 'note' is read as a new mapping
- name: Build note: nightly
# right
- name: "Build note: nightly"

Fix the indentation of the offending key

Align the key with its intended siblings so it is not parsed inside a scalar.

How to prevent it

  • Quote string values that contain :.
  • Lint workflows with yamllint or an editor schema before pushing.
  • Keep two-space indentation consistent throughout the file.

Related guides

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