# Fix `mapping values are not allowed here` (docker-compose)

## TL;DR

Your compose file has a tab character (or bad indentation) where YAML expects spaces. Search the file for tabs, replace them with spaces, and re-run. docker compose config tells you instantly whether the file parses now.

The error, verbatim:

```text
mapping values are not allowed here
```

## Steps

1. Find the tab characters in the compose file:

   ```
   grep -Pn "	" docker-compose.yml
   ```
   Success check: cat -A shows ^I wherever a tab hides; grep finds the lines.

2. Replace every tab with spaces (2 spaces per indent level is the compose convention):

   ```
   grep -Pn "	" docker-compose.yml
   ```
   Success check: No output means no tabs remain.

3. Validate the file parses cleanly:

   ```
   docker compose config
   ```
   Success check: The parsed file prints with no errors.

## When to use

You hit this exact error while using docker-compose. The trigger list below matches your situation.

## When NOT to use

If the error text differs, or the failure is in a different tool (e.g. a Docker daemon error when you only need the compose fix), find the skill for that exact error instead.

## Tool compatibility

docker-compose v1 and Compose v2. Any OS; common on Windows editors.

## Variant phrasings

### mapping values are not allowed here

### yaml: mapping values are not allowed here

## Root cause

YAML forbids tab characters for indentation. A tab (or a misaligned colon, like key value value split across a line break) makes the YAML parser read a mapping where it expected a scalar, and compose surfaces the parser error. It is always a whitespace problem in the compose file, never a compose bug.

## Edge cases

- A stray tab anywhere in the file breaks parsing, not just near the reported line.
- Copy-pasting from web pages can introduce non-breaking spaces that look like spaces but are not.
- After fixing, docker compose config is the fastest way to confirm the file parses.

## Where this came from

Resolved from the public discussion at https://stackoverflow.com/questions/39077526 (so:39077526).
