bynk.agent.migrate_impure
Error A migrate step uses an effect, a capability, ?, expect, or the agent's key; steps are pure and key-free so a migration sweep can run them by object ID.
A migration step must be pure and must not read the agent's key. A migration sweep wakes each stored instance by its object ID, which does not recover the key, so a step cannot depend on who the instance is, and it cannot use ?, expect or Effect.pure. Compute the new value from old and the carried fields. If it needs the key, do that in a handler after the migration.
Example
type CartV1 = { owner: String, total: Int }
migrate from 1 (old: CartV1) { ownerName := id // ✗ reads the agent's key}
migrate from 1 (old: CartV1) { ownerName := old.owner // ✓}In the Book
See also
- Every code in its category, Agents, on the diagnostic index.
bynk explain bynk.agent.migrate_impureshows the same from the installed toolchain, without a network.