Skip to content
Playground(another site)

bynk.provider.agent_call_undeclared_capability

Error A provider calls an agent handler that needs a capability the provider's given does not list.

A provider calls an agent handler, and the handler needs a capability the provider's given does not list. A handler's given is widened to cover the agent handlers it calls, but a provider's is not. The provider is constructed with exactly the capabilities in its given, and those are all it can hand on to the agent. So the provider must list everything the agent handler needs: the handler's own given, and the given of any agent handler it calls in turn.

Example

agent Index {
key name: String
store hits: Cell[Int]
on call withdraw() -> Effect[()] given Files { … }
}
provides Takedown = Bucket given Clock {
fn take(name: String) -> Effect[()] { Index(name).withdraw() } // ✗ `withdraw` needs `Files`
}
provides Takedown = Bucket given Clock, Files { // ✓ `Files` is listed
fn take(name: String) -> Effect[()] { Index(name).withdraw() }
}

In the Book

See also

  • The grammar rule it governs: provider_decl.
  • Every code in its category, Providers, on the diagnostic index.
  • bynk explain bynk.provider.agent_call_undeclared_capability shows the same from the installed toolchain, without a network.