M Mozhi v3.7.0 code

Error reference › CLI diagnostics

CLI002

unknown command

error
verifiedverified on v3.7.0 categorycli terminalstable code

What it means

Unknown single words used to fall through to 'treat as script', producing a confusing 'cannot open file'. Since v3.2.0, a word that (a) is not an existing path, (b) contains no `/`, and (c) does not end in `.mz` is reported as an unknown command.

Trigger condition

The first argument is a word that is neither a known command nor an existing file — e.g. a typo like `mozhi ruun app.mz`.

Minimal failing example

$ mozhi ruun app.mz

Verified fix

$ mozhi run app.mz

Known commands: run, new, dev, serve, test, fmt, lint, build, repl, version, help.

What the interpreter prints

error[CLI002]: unknown command
  --> app.mz:1:16
 1 | $ mozhi ruun app.mz
   |                 ^
   |
reason: (the exact problem, with positions)
help:   (a suggested fix appears here)
docs:   https://crossberry-in.github.io/mozhi-doc/errors/CLI002
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

Run `mozhi help` for the command list. To run a script, pass a path ending in `.mz`.

Related syntax

CLI commands

Related diagnostics

CLI001

Reference links

Limitations

The heuristic keeps legacy behavior for anything that names an existing file or ends in `.mz` — those still run through the script path (CLI001 if unreadable).