Error reference › Standard-library diagnostics
STDLIB001
invalid argument to built-in function
errorWhat it means
Native functions validate their inputs and report failures with a module-prefixed message (`math:`, `json:`, `fs:`, `db:`, `http:`, `web:`, `template:`). The classifier maps those prefixes to this code.
Trigger condition
A built-in or native-module function received an invalid argument — wrong type, out-of-domain value, malformed input.
Minimal failing example
import math
echo(string(math.factorial(-1)))Verified fix
(validate the argument before calling the function)Check the function's documented domain before calling; validate inputs.
What the interpreter prints
error[STDLIB001]: invalid argument to built-in function
--> 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/STDLIB001Run
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
Read the `reason` text — it names the module and the specific problem. Guard inputs with conditions before the call.
Related syntax
Standard library
Related diagnostics
Reference links
Limitations
These errors carry no source span (the AST node is not available inside built-ins); the message and docs link are still complete.