M Mozhi v3.7.0 code

Error reference › Lexer diagnostics

LEX003

unknown escape sequence in string

warning
verifiedverified on v3.7.0 categorylexer terminalstable code

What it means

Mozhi supports exactly six escapes: `\n`, `\t`, `\r`, `\"`, `\\` and `\0`. Anything else after a backslash is kept literally and reported as a warning — the program still runs.

Trigger condition

A string contains an escape sequence the language does not define, e.g. `\q` or `\x`.

Minimal failing example

echo("col1\qcol2")

Verified fix

echo("col1\\qcol2")

Use `\\` when a literal backslash is intended, or pick one of the six supported escapes.

What the interpreter prints

error[LEX003]: unknown escape sequence in string
  --> app.mz:1:16
 1 | echo("col1\qcol2")
   |                 ^
   |
reason: (the exact problem, with positions)
help:   (a suggested fix appears here)
docs:   https://crossberry-in.github.io/mozhi-doc/errors/LEX003
Run mozhi --json run app.mz to get the same information as machine-readable JSON (schema mozhi.diagnostics.v1), or --verbose to also show grouped related diagnostics. See the CLI reference.

Suggested fix

Replace the unknown escape with the intended character or escape the backslash.

Related syntax

String literals, escape sequences

Related diagnostics

LEX002

Reference links

Limitations

This is a warning (severity `warning`), not an error: the exit code is not affected. The diagnostic was added in v3.2.0; older versions silently accepted unknown escapes.