E0092: face_mismatch
E0092 face_mismatch — a handler and its face signal disagree.
A compile-time error of soma check, the checker of the Soma programming language (soma explain E0092).
The rule
When a cell declares a signal in its face, the on handler for it must take the same parameter types in the same order; soma check reports E0092 at the face signal when a position differs (here the face says cents: Int and the handler says cents: Float). Callers, soma describe and HTTP clients follow the face, while the handler's body runs with its own declaration, so the two must agree. Fix whichever side is wrong; a mismatch in a parameter's name alone is only a warning.
A program that triggers it
wrong.cell
cell Wallet {
face {
signal deposit(owner: String, cents: Int) -> Int
}
memory {
balances: Map<String, Int> [persistent]
}
on deposit(owner: String, cents: Float) {
let total = (balances.get(owner) ?? 0) + cents
balances.set(owner, total)
return total
}
}What soma check prints:
$ soma check wrong.cell
warning: handler 'deposit' returns a Float (`total`) but its face declares `-> Int` — fix the value or the face (an error in edition 2027)
--> wrong.cell:11:16
|
11 | return total
| ^
error: parameter 2 of `deposit`: the face declares `cents: Int` but the handler takes `cents: Float` — callers follow the face (describe publishes it); make them agree
--> wrong.cell:3:9
|
3 | signal deposit(owner: String, cents: Int) -> Int
| ^
= code: E0092
✗ 1 error(s), 1 warning(s).The fix field of soma check --json: callers follow the face (describe publishes it); make them agree
The fix
On line 8, on deposit(owner: String, cents: Float) { becomes on deposit(owner: String, cents: Int) {.
wrong.cell → right.cell
--- wrong.cell
+++ right.cell
@@ -6,5 +6,5 @@
balances: Map<String, Int> [persistent]
}
- on deposit(owner: String, cents: Float) {
+ on deposit(owner: String, cents: Int) {
let total = (balances.get(owner) ?? 0) + cents
balances.set(owner, total)With the fix, soma check accepts the program:
$ soma check right.cell
✓ All checks passed.