// SQL Server error reference

SQL Server error 3903: ROLLBACK has no corresponding BEGIN

ROLLBACK TRANSACTION ran when no transaction was open, typically a second rollback after the transaction was already rolled back.

Error number
3903
Severity
16
Category
Transactions and locking
Error message
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION.

What it means

Like 3902, this means @@TRANCOUNT was 0 when ROLLBACK ran. The usual reason is that the transaction was already rolled back: by an inner procedure, a trigger, XACT_ABORT, or a deadlock. Error handling that always calls ROLLBACK without checking hits this.

Common causes

  • A CATCH block that calls ROLLBACK unconditionally after the transaction was already rolled back.
  • Both an inner and an outer procedure rolling back.
  • A ROLLBACK with no BEGIN TRANSACTION in the batch.

How to fix it

  1. Only roll back when a transaction is open.

    IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION;
  2. Use XACT_STATE() in CATCH blocks, which also tells you whether the transaction can still be committed.

    IF XACT_STATE() <> 0 ROLLBACK TRANSACTION;

Reproduce it safely

ROLLBACK TRANSACTION;  -- Msg 3903

Related errors

More transactions and locking errors

The code and message text are from the Microsoft Database Engine events and errors reference. Browse the full SQL Server error list or search every database error.

// fewer errors, faster fixes

Work on SQL Server in SQLly

A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for SQL Server and the other databases you use.