OneShot

All packsWebhook Durability & ReplaySolve

postgres savepoint unique violation aborted transaction webhook

Catch the unique violation without a SAVEPOINT and the whole transaction is already dead

In Postgres, catching a unique-violation without a SAVEPOINT first leaves the transaction aborted -- every statement after it fails with 25P02, silently, unless the catch is scoped exactly right (D8).

This is one of the things Webhook Durability & Replay already handles. Receive webhooks without losing, duplicating or misordering them when the sender retries.

Buy for $1493 of 3 clean-room builds passed · full refund if it fails on your machine

Is this you?

A try/catch wrapped around the whole transaction -- ledger insert and business mutation together -- swallows an unrelated constraint violation from the mutation itself and reports success while the database has actually diverged. In raw pg specifically, catching a unique-violation with no SAVEPOINT first leaves the transaction already poisoned, so every statement after it fails with 25P02 even though the code looks like it recovered.

Why this one is easy to get wrong

Wrapping the whole operation in one try/catch is the natural way to write "insert this row, and if it's a duplicate, no-op" -- it reads as simpler than scoping the catch to a single statement, and it works perfectly the first time a genuine duplicate is tested. What it hides is a second, unrelated failure mode: any real constraint violation in the business mutation now gets silently treated the same as a harmless duplicate.

What you get instead

D8 wraps only the ledger insert in a SAVEPOINT: insert, and on error code 23505 specifically, roll back to that savepoint and return {applied: false} -- rethrowing anything that isn't 23505. The mutation itself runs outside the try, so if it throws, the ledger row and the change roll back together and the delivery is retried whole, which is the property that makes the ledger mean anything at all.

Source: ARCHITECTURE.md D8 — checkable in the pack you receive

How you actually use this

You don’t install a library or wire up an SDK. Your own coding agent builds the code in your project, and you keep it — no runtime dependency on us.

  1. Step 1

    Download and unzip

    You get a folder: the docs that tell an agent what to build, a starting skeleton, and the test suite that decides when it's done.

  2. Step 2

    Open it in Claude Code or Cursor

    Point your coding agent at the folder. Nothing to install, no account with us, no API key.

  3. Step 3

    Paste one prompt

    The pack contains the exact prompt. Paste it as your first message and leave it alone — it works through the build itself, choosing a cheaper or stronger model per task.

  4. Step 4

    Run ./verify.sh

    One command. It prints a pass or fail for every check. Green means the build is done — the same script we ran to produce the receipt on this page.

Typical build: about 40 minutes of your agent working, mostly unattended. Then you integrate the working module into your app the way you would any code you’d written yourself.

Why you can believe this

3 of 3 runs passed

We ran this pack from an empty folder 3 times and published exactly what happened — every check, the model, the token cost, the wall time. Not a testimonial, and not our opinion: the same verify.sh you run yourself. Read the full receipt →

Buy for $14914-day refund if verify.sh fails →

Related problems