soma.cell

E0101: builtin_arity

E0101 builtin_arity — a builtin called with too few or too many arguments.

A compile-time error of soma check, the checker of the Soma programming language (soma explain E0101).

The rule

soma check knows how many arguments each builtin takes and reports E0101 when a call passes too many or too few, also in method form, where the value before the dot counts as the first argument. Soma's split(text, sep) has no limit argument like Python's maxsplit, and the message says the extra argument would have been silently ignored. Pass only the arguments the builtin declares; soma describe --builtins --json lists every signature.

A program that triggers it

wrong.cell

cell Ledger {
    face {
        signal parse_entry(line: String) -> Map
    }
    on parse_entry(line: String) {
        let parts = split(line, ",", 1)
        require len(parts) == 2 else BadLine "expected account,cents: {line}"
        let cents = parse_int(trim(parts[1])) ?? 0
        return map("account", trim(parts[0]), "cents", cents)
    }
}

What soma check prints:

$ soma check wrong.cell
error: split() takes at most 2 arguments (3 given) — the extra ones were silently ignored
  --> wrong.cell:6:21
  |
6 |         let parts = split(line, ",", 1)
  |                     ^
  = code: E0101
✗ 1 error(s), 0 warning(s).

The fix field of soma check --json: the extra ones were silently ignored

On line 6, let parts = split(line, ",", 1) becomes let parts = split(line, ",").

wrong.cell → right.cell

--- wrong.cell
+++ right.cell
@@ -4,5 +4,5 @@
     }
     on parse_entry(line: String) {
-        let parts = split(line, ",", 1)
+        let parts = split(line, ",")
         require len(parts) == 2 else BadLine "expected account,cents: {line}"
         let cents = parse_int(trim(parts[1])) ?? 0

With the fix, soma check accepts the program:

$ soma check right.cell
✓ All checks passed.