Skip to content
Playground(another site)

bynk.parse.expected_agent_key

Error Expected a key declaration in an agent.

An agent is addressed by its key, so the key is the first thing in its body: key id: Type. Anything else there, usually a store field written first, is refused, so that how an agent is found is the first thing a reader sees. Move the key line to the top.

Example

agent Counter {
store n: Cell[Int] // ✗ the key comes first
key id: String
on call get() -> Effect[Int] { … }
}
agent Counter {
key id: String // ✓
store n: Cell[Int]
on call get() -> Effect[Int] { … }
}

In the Book

See also

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