Skip to content
Playground(another site)

bynk.context.duplicate_binding

Error A Worker would declare two bindings with the same name, such as an agent Kv and the bynk.cloudflare KV namespace (both KV).

A Worker's bindings share one env, so each name can be declared once. Bynk names the bindings after what the context declares: an agent, a consumed context, a derived capability, and the Kv namespace of bynk.cloudflare, whose binding is KV. Here the consumed context kv also becomes a Service Binding named KV, and the two would overwrite each other. Rename the declaration behind one of them. The error is on the one you can rename, not on the bynk.cloudflare clause. A bundle build has no bindings, so only the Workers target checks this.

Example

ops/hub.bynk
consumes bynk.cloudflare { Kv } // the KV namespace is bound as `KV`
consumes kv // ✗ a Service Binding, also named `KV`
// ops/hub.bynk
consumes counter // ✓ a binding named `COUNTER`

In the Book

See also

  • Every code in its category, Contexts, on the diagnostic index.
  • bynk explain bynk.context.duplicate_binding shows the same from the installed toolchain, without a network.