retrysafe
← All rules

effect-before-record

warning

An effect runs before the event is recorded, behind a check that is not an atomic claim.

Why it goes wrong

If the process dies between the effect and the record, the retry finds no record, passes the check, and repeats the effect.

Safe pattern

Record and write in one transaction for DB effects; for external calls use an idempotency key or an outbox written in the same transaction as the record.

Configure

// retrysafe.config.ts
export default defineConfig({
  rules: { "effect-before-record": "warning" }, // or "off"
});

// or, for one line (a reason is required):
// retrysafe-ignore effect-before-record -- <why this is safe>