# X_DB_TRANSACTION_CLOSED

## Means

statement on a finished transaction

## Typical cause

a statement was sent on a transaction handle whose scope had already committed or rolled back: an un-awaited promise, or the loser of a Promise.all, outlived withTransaction

## Fix

`await it inside withTransaction(fn); for work that must outlive the scope, wrap it in outsideTransaction(fn)`

[Entity and database](/error-codes#entity-and-database)
