Skip to content
Latchkey

Azure Pipelines "mapping values are not allowed here"

The YAML parser hit a colon where it did not expect one. Almost always this is an indentation slip or an unquoted value containing a : - the document never parses, so the pipeline never starts.

What this error means

The run fails immediately at parse time with mapping values are not allowed in this context, pointing at a line and column in azure-pipelines.yml. No jobs queue because the file is structurally invalid.

Azure DevOps
/azure-pipelines.yml (Line: 12, Col: 9): While parsing a block mapping,
did not find expected key.
mapping values are not allowed in this context

Common causes

Wrong indentation under a key

A step or property is indented one level too shallow or too deep, so the parser reads its key: value colon as belonging to the wrong mapping.

An unquoted value containing a colon

A value like displayName: Build: release or a time: 10:30 is read as a nested mapping. Any value with a bare : followed by a space must be quoted.

How to fix it

Quote values that contain a colon

Wrap any scalar that contains : in single quotes so the parser treats it as one value.

azure-pipelines.yml
steps:
  - script: echo build
    displayName: 'Build: release'   # quoted - the colon is now safe

Fix the indentation at the reported line

  1. Open azure-pipelines.yml at the exact line and column from the error.
  2. Confirm every list item under steps: aligns and uses spaces, never tabs.
  3. Validate locally with a YAML linter or the Azure DevOps "Validate" button in the pipeline editor before pushing.

How to prevent it

  • Use spaces only - configure your editor to expand tabs in YAML.
  • Run a YAML linter (yamllint) in a pre-commit hook.
  • Use the pipeline editor’s Validate action to catch parse errors before committing.

Related guides

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