M Mozhi v3.7.0 code

Error reference › Name-resolution diagnostics

NAME002

undefined function

error
verifiedverified on v3.7.0 categoryname terminalstable code

What it means

Calls resolve in order: local/global variables holding functions, built-in table, module members (`module.func`). An unresolvable name produces this diagnostic with the offending name in the message.

Trigger condition

A call names a function that does not exist — neither a user function, a built-in, nor a member of the targeted module.

Minimal failing example

upcase("hello")

Verified fix

echo("hello")

Mozhi has no global `upcase`; use the built-ins that exist (echo, len, string, ...) or functions from an imported module.

What the interpreter prints

error[NAME002]: undefined function
  --> app.mz:1:16
 1 | upcase("hello")
   |                 ^
   |
reason: (the exact problem, with positions)
help:   (a suggested fix appears here)
docs:   https://crossberry-in.github.io/mozhi-doc/errors/NAME002
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 spelling against the built-in list and your imports. For module functions the import must come first: `import math` then `math.pow(2, 10)`.

Related syntax

Function calls, imports

Related diagnostics

NAME001IMPORT001

Reference links

Limitations

Argument-count mismatches are NOT errors in Mozhi (missing parameters read as null, extras are ignored) — that leniency is a language property, not a bug.