M Mozhi v3.7.0 code

Error reference › Import diagnostics

IMPORT002

invalid import syntax

error
verifiedverified on v3.7.0 categoryimport terminalstable code

What it means

`import` is a bare keyword statement in Mozhi, not a function: the module name follows directly without parentheses or quotes. The aliased form is `import alias from "package"`.

Trigger condition

Import syntax that Mozhi does not support — most commonly `import("math")`, treating import as a function call.

Minimal failing example

import("math")

Verified fix

import math

Verified behavior: bare keyword form loads the built-in module; the call form is a parse error.

What the interpreter prints

error[IMPORT002]: invalid import syntax
  --> app.mz:1:16
 1 | import("math")
   |                 ^
   |
reason: (the exact problem, with positions)
help:   (a suggested fix appears here)
docs:   https://crossberry-in.github.io/mozhi-doc/errors/IMPORT002
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

Write `import math` (no parentheses, no quotes). For aliases: `import http from "mozhi-http"`.

Related syntax

import statement

Related diagnostics

IMPORT001

Reference links

Limitations

The diagnostic fires specifically when `(` follows `import`; other malformed imports surface as PARSE001.