Skip to content
Playground(another site)

bynk.consumes.unknown_service

Error Called a service the consumed context does not declare.

A call such as pay.charge(…) reaches a service of the consumed context, and pay has none by that name. Only a service's on call handler can be called across contexts, so check the spelling against the consumed context and that the service has an on call handler. A call with the wrong number of arguments is bynk.consumes.service_arity.

Example

pay.bynk
context pay
service charge {
on call(amount: Int) -> Effect[Int] by Caller {
Effect.pure(amount)
}
}
// shop.bynk
context shop
consumes pay
service checkout {
on call() -> Effect[Int] by Caller {
pay.charg(1) // ✗ `pay` has no service `charg`
}
}
service checkout {
on call() -> Effect[Int] by Caller {
pay.charge(1) // ✓ the declared name
}
}

In the Book

See also

  • The grammar rule it governs: consumes_decl.
  • Every code in its category, Consumes, on the diagnostic index.
  • bynk explain bynk.consumes.unknown_service shows the same from the installed toolchain, without a network.