Skip to content
Playground(another site)

bynk.event.pattern_unknown_variant

Error A from Events(E { ... }) subscription pattern's variant value names a variant that does not exist on the field's declared sum type.

A pattern that tests a sum-typed field names a variant of that type, and an emission can only carry the variants the type declares. A name it lacks, often a misspelling, could never match. Use a variant the type declares. A variant that carries a payload is refused too, as bynk.event.pattern_variant_payload.

Example

type Region =
| Domestic
| International
| Refunded(reason: String)
event Paid = { id: String, region: Region }
service onPaid from Events(Paid { region: Region.Nowhere, .. }) { // ✗ `Region` has no `Nowhere`
service onPaid from Events(Paid { region: Region.Domestic, .. }) { // ✓

In the Book

See also

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