Skip to content
Playground(another site)

bynk.event.pattern_duplicate_field

Error A from Events(E { ... }) subscription pattern listed the same field more than once.

A subscription pattern narrows delivery by field: from Events(Paid { region: Domestic, .. }) runs the handler only when region is Domestic. The listed fields combine with AND, so naming one twice would ask for two values at once, or say the same thing twice, and is refused rather than guessed at. List each field once. To accept several values, leave the field out of the pattern and match on it in the handler.

Example

service OnPaid from Events(Paid { region: Domestic, region: International, .. }) { // ✗ `region` twice
service OnPaid from Events(Paid { region: Domestic, .. }) { // ✓
on event(e: Paid) -> Effect[()] { … }
}

In the Book

See also

  • Every code in its category, Events, on the diagnostic index.
  • bynk explain bynk.event.pattern_duplicate_field shows the same from the installed toolchain, without a network.