M Mozhi v3.7.0 code

Error reference › CLI diagnostics

CLI001

cannot open file

error
verifiedverified on v3.7.0 categorycli terminalstable code

What it means

The CLI reads the file before parsing; failure to open produces this diagnostic with the path in the message.

Trigger condition

A script path was passed that does not exist or cannot be opened for reading.

Minimal failing example

$ mozhi run missing.mz

Verified fix

$ mozhi run existing.mz

Pass a path that exists; relative paths resolve against the current directory.

What the interpreter prints

error[CLI001]: cannot open file
  --> app.mz:1:16
 1 | $ mozhi run missing.mz
   |                 ^
   |
reason: (the exact problem, with positions)
help:   (a suggested fix appears here)
docs:   https://crossberry-in.github.io/mozhi-doc/errors/CLI001
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 path and your current directory. Note: `mozhi run` needs the file argument; see CLI003 for the missing-argument case.

Related syntax

CLI: run

Related diagnostics

CLI003

Reference links

Limitations

Permission errors are reported with the same code (the OS error text is included).