Skip to content
Playground(another site)

bynk.store.unkeyable_key

Error A store Set element or Map/Cache key is not value-keyable — it must be String, Int, or a refined/opaque type over them (#1680).

A store Map or Cache key, or a store Set element, must be String, Int or a refined or opaque type over them. A store collection is saved as a JSON object keyed by the key's string form, and a record has no stable string form, so it cannot be a key (a composite key is not supported yet). Key by one of the record's id fields, or by an enum's name as a String. A value Map or Set follows a wider rule, bynk.types.not_keyable.

Example

type Point = { x: Int, y: Int }
store cells: Map[Point, Int] // ✗ a record has no stable string key
store cells: Map[String, Int] // ✓ key by a string, such as an id

In the Book

See also

  • Every code in its category, Agent storage, on the diagnostic index.
  • bynk explain bynk.store.unkeyable_key shows the same from the installed toolchain, without a network.