DBAtlas · Database operations atlas

225 TransactionTooOld: TransactionTooOld

MongoDB

What does it mean?

A command was run inside a multi-document transaction, but its transaction number is older than the latest transaction number the server has seen for that session. In other words, a newer transaction has been started, so this old one is no longer valid.

Why does it happen?

A new transaction was started in the same session before the old one completed, or transaction numbers advanced out of order due to concurrency. It usually happens when a session object is shared incorrectly or multiple threads use the same session.

How to fix it

Manage the session lifecycle correctly for each logical transaction; do not share a session concurrently across multiple threads. Run transactions with the driver's recommended withTransaction/callback API (it handles retries and number management). Close the previous transaction with commit/abort before starting a new one.

Open in DBAtlas →

More from this engine