# failed to solve: dockerfile parse error on line 5: unknown instruction: ESCAPE

- **ID:** `docker/dockerfile-parse-error-invalid-escape`
- **Domain:** docker
- **Category:** build_error
- **Verification:** ai_generated
- **Fix Rate:** 95%

## Root Cause

The Dockerfile contains a syntax error where 'ESCAPE' is used incorrectly, likely a typo for 'SHELL' or a misplaced escape directive, causing the parser to treat it as an unknown instruction.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Docker 25.0.3 | active | — | — |
| BuildKit 0.12.5 | active | — | — |

## Workarounds

1. **Remove the erroneous 'ESCAPE' line. If the intent was to change the escape character, use the parser directive '# escape=`' at the top of the Dockerfile (before any instructions).** (95% success)
   ```
   Remove the erroneous 'ESCAPE' line. If the intent was to change the escape character, use the parser directive '# escape=`' at the top of the Dockerfile (before any instructions).
   ```
2. **Replace 'ESCAPE' with the correct instruction, e.g., if it was meant to be a shell command, use 'RUN echo hello'.** (90% success)
   ```
   Replace 'ESCAPE' with the correct instruction, e.g., if it was meant to be a shell command, use 'RUN echo hello'.
   ```

## Dead Ends

- **Add a backslash before ESCAPE to escape it** — Backslash does not change the parser directive; ESCAPE is not a valid instruction in any context. (85% fail)
- **Change the line to 'RUN ESCAPE'** — RUN ESCAPE is still invalid; ESCAPE is not a shell command. (90% fail)
- **Ignore the error and continue building with --force-rm** — BuildKit stops on parse errors; --force-rm only cleans intermediate containers, not fix syntax. (95% fail)
