retrysafe
← All rules

incrementing-write-unguarded

error

A relative write (increment, x = x + n, $inc, push) runs with no dedupe guard.

Why it goes wrong

Unlike setting a value, applying a delta is not idempotent: every redelivery adds it again, silently corrupting balances and counters.

Safe pattern

Claim the event in the same transaction as the write, or store the event's contribution keyed by event id and derive the total from it.

Configure

// retrysafe.config.ts
export default defineConfig({
  rules: { "incrementing-write-unguarded": "error" }, // or "off"
});

// or, for one line (a reason is required):
// retrysafe-ignore incrementing-write-unguarded -- <why this is safe>