Direct answer

The parser reached a line that cannot belong to the current mapping or sequence. Compare indentation with sibling lines and inspect the previous key.

Where this error appears

YAML configuration files

Root cause

A sequence item may be over-indented, a mapping may be missing a colon, or a multiline value may have ended unexpectedly.

Minimal reproduction

services:
  api:
    image: demo
   ports:
     - 8080

Corrected example

services:
  api:
    image: demo
    ports:
      - 8080

Verify the fix

Validate the corrected document before committing it.

Things to check

  • Use an editor that displays whitespace.
  • Reduce the document until the first failing block is obvious.