# Postgres error 25P02: current transaction is aborted, commands ignored until end of transaction block

> An earlier statement in this transaction failed, and Postgres refuses everything else until the transaction ends.

Source: https://scribase.com/postgres-errors/25p02

SQLSTATE class: Invalid Transaction State. Over PostgREST/supabase-js this maps to HTTP 500.

## Causes

- Code caught an error from one statement and carried on using the same transaction.
- A pooled connection was returned with a failed transaction still open.

## Fixes

- Find the first error in the log: that is the real problem. This one is only the consequence.
- Roll back after any error, or use a SAVEPOINT around statements that are allowed to fail.
- Make sure the pool resets connections (ROLLBACK or DISCARD ALL) when they are returned.

## Example

```sql
begin;
savepoint try_insert;
insert into tags (name) values ('postgres');   -- may fail
rollback to savepoint try_insert;               -- the transaction is usable again
commit;
```