Skip to content

ROLLBACK

Aborts the current transaction and discards all uncommitted changes.

ROLLBACK

This command takes no parameters.

Simple string: OK on success.

The command cancels the active FoundationDB transaction bound to the current session and releases all associated resources. After cancellation, the session resets its transaction state: the BEGIN flag is cleared, auto-commit is re-enabled, post-commit hooks are discarded, and the user version counter is reset.

The session returns to its default state and is ready to accept new commands or start a new transaction with BEGIN.

Error CodeDescription
TRANSACTIONThere is no transaction in progress on the session.

Roll back a transaction:

> BEGIN
OK
> ROLLBACK
OK

Attempt to roll back without an active transaction:

> ROLLBACK
(error) TRANSACTION there is no transaction in progress.