M Mozhi v3.7.0 code

Error reference › Runtime diagnostics

RUNTIME004

undefined method

error
verifiedverified on v3.7.0 categoryruntime terminalstable code

What it means

Method tables exist per type (arrays: push/pop/..., maps: has/delete/..., strings: replace/split/..., modules: their exports). Numbers have no methods. Mozhi has no bitwise operations at all — `bxor`, `band`, `bor`, `shl`, `shr` do not exist anywhere.

Trigger condition

A method is called on a value that has no such method — commonly a bitwise method like `bxor` on a number.

Minimal failing example

echo(string(5.bxor(3)))

Verified fix

echo(string(5 ** 3))

Exponentiation is `**` (verified: `5 ** 3` → `125`). There is no XOR/bxor in Mozhi; if you need bitwise math, compute it in arithmetic terms or wait for a future language release.

What the interpreter prints

error[RUNTIME004]: undefined method
  --> app.mz:1:16
 1 | echo(string(5.bxor(3)))
   |                 ^
   |
reason: (the exact problem, with positions)
help:   (a suggested fix appears here)
docs:   https://crossberry-in.github.io/mozhi-doc/errors/RUNTIME004
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 method table for the value's type. For power use `**`; for logical conditions use `and`/`or`/`!`.

Related syntax

Method calls, operators

Related diagnostics

LEX001NAME002

Reference links

Limitations

The error message names the value's type and the method; per-type method lists are in the standard-library docs.