M Mozhi v3.7.0 code

Error reference › Parser diagnostics

PARSE005

unexpected end of input

error
verifiedverified on v3.7.0 categoryparser terminalstable code

What it means

When the current token is EOF and a specific token was required, the end-of-input diagnostic is emitted instead of a generic unexpected-token error, because the fix is almost always 'continue the construct that was left open'.

Trigger condition

The input ends while the parser still needs a token to finish a construct — e.g. after `fn name(` or an unclosed `{`.

Minimal failing example

fn greet(name {
  echo(name)
}

Verified fix

fn greet(name) {
  echo(name)
}

Combine with the PARSE002 message to find the construct that was left open.

What the interpreter prints

error[PARSE005]: unexpected end of input
  --> app.mz:1:16
 1 | fn greet(name {
   |                 ^
   |
reason: (the exact problem, with positions)
help:   (a suggested fix appears here)
docs:   https://crossberry-in.github.io/mozhi-doc/errors/PARSE005
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

Check the last open construct — functions, blocks, calls, arrays — and complete it.

Related syntax

Function declarations, blocks

Related diagnostics

PARSE002LEX004

Reference links

Limitations

Only the first EOF problem is reported per parse; fix it and re-run to see any others.