Skip to content
Playground(another site)

bynk.agent.handler_arity

Error An agent handler was called with the wrong number of arguments.

A handler call is checked against the handler's declaration, as a function call is: it must pass one argument for each parameter, no more and no fewer. The agent's key is not one of them, since it was given when the agent was constructed. Match the call to the parameter list. If the handler is missing a parameter it needs, add it to the declaration and update every caller.

Example

agent Counter {
key id: String
store n: Cell[Int]
on call get() -> Effect[Int] {
n
}
}
let v <- Counter("a").get(1) // ✗ `get` takes no arguments
let v <- Counter("a").get() // ✓

In the Book

See also

  • The grammar rule it governs: agent_decl.
  • Every code in its category, Agents, on the diagnostic index.
  • bynk explain bynk.agent.handler_arity shows the same from the installed toolchain, without a network.