Error reference › Parser diagnostics
PARSE003
invalid assignment target
errorWhat it means
Only variables (`x = ...`), array slots (`a[i] = ...`) and map keys (`m["k"] = ...`) are assignable. Assignments are checked at evaluation time; literals and computed values have no storage to write to.
Trigger condition
An assignment targets something that cannot hold a value — a literal, an expression result, or a non-container property access.
Minimal failing example
5 = xVerified fix
let x = 5Assign to a declared variable or to a container slot that exists.
What the interpreter prints
error[PARSE003]: invalid assignment target
--> app.mz:1:16
1 | 5 = x
| ^
|
reason: (the exact problem, with positions)
help: (a suggested fix appears here)
docs: https://crossberry-in.github.io/mozhi-doc/errors/PARSE003Run
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
Declare the target first with `let`/`const`, or restructure so the left side is a variable, array index, or map key.
Related syntax
Assignment, let/const, maps and arrays
Related diagnostics
Reference links
Limitations
The check runs at evaluation; a code path that never executes the bad assignment will not report it (the interpreter has no static type checker).