M Mozhi v3.7.0 code

Error reference › Import diagnostics

IMPORT003

imported module contains errors

error
verifiedverified on v3.7.0 categoryimport terminalstable code

What it means

Module sources are parsed with the same parser as main programs. Errors inside the module are reported with this code and name the module file, so the problem is attributed to the dependency rather than your code.

Trigger condition

An imported module was found but failed to load — unreadable file or a parse error inside the module source.

Minimal failing example

./.mozhi/libs/mylib.mz contains `let = 5` (a parse error)

Verified fix

fix mylib.mz: `let x = 5`

Fix the syntax error in the named module file and re-run.

What the interpreter prints

error[IMPORT003]: imported module contains errors
  --> app.mz:1:16
 1 | ./.mozhi/libs/mylib.mz contains `let = 5` (a parse error)
   |                 ^
   |
reason: (the exact problem, with positions)
help:   (a suggested fix appears here)
docs:   https://crossberry-in.github.io/mozhi-doc/errors/IMPORT003
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

Open the file named in the message at the reported position; run `mozhi lint <module file>` to see its diagnostics with codes.

Related syntax

Modules, libraries

Related diagnostics

PARSE001IMPORT001

Reference links

Limitations

Diagnostics from the module body are reported as a summary here; run the linter on the module file for the full per-line detail.