hibernate/hibernate-orm · error · TransactionException
UserTransaction reported transaction status as unknown
Error message
UserTransaction reported transaction status as unknown
What it means
The UserTransaction adapter's getStatus() maps the JTA status int through StatusTranslator; a null mapping - typically Status.STATUS_UNKNOWN or a value Hibernate does not recognize - throws 'UserTransaction reported transaction status as unknown'. It means the UserTransaction/TransactionManager cannot tell what state the transaction is in, usually after an internal error or while recovery is in progress.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/resource/transaction/backend/jta/internal/JtaTransactionAdapterUserTransactionImpl.java:92
userTransaction.rollback();
JTA_LOGGER.calledUserTransactionRollback();
}
else {
markRollbackOnly();
}
}
catch (Exception e) {
throw new TransactionException( "JTA UserTransaction.rollback() failed", e );
}
}
@Override
@Nonnull
public TransactionStatus getStatus() {
try {
final var status = StatusTranslator.translate( userTransaction.getStatus() );
if ( status == null ) {
throw new TransactionException( "UserTransaction reported transaction status as unknown" );
}
return status;
}
catch (SystemException e) {
throw new TransactionException( "JTA UserTransaction.getStatus() failed", e );
}
}
@Override
public void markRollbackOnly(){
try {
userTransaction.setRollbackOnly();
}
catch (SystemException e) {
throw new TransactionException( "Unable to mark transaction for rollback only", e );
}
}
View on GitHub (pinned to fad1729dce)
Solutions
- Check TM/UT health and logs - an earlier failure usually precedes the unknown status
- Let recovery finish or restart the TM before further transaction work
- Upgrade the JTA implementation if it emits non-standard status codes
Defensive patterns
Strategy: try-catch
Try / catch
catch (TransactionException e) {
// 'UserTransaction reported transaction status as unknown'
// Environment-level signal: report TM health, stop transaction work
alertOnTransactionManagerHealth(e);
} Prevention
- Monitor TM health; unknown status usually follows an internal TM error
- Avoid transaction work during TM recovery or shutdown
- Use a standard-compliant JTA implementation
When it happens
Trigger: UserTransaction.getStatus() returning STATUS_UNKNOWN or an unexpected code, hit from Transaction.getStatus() or from begin()'s NOT_ACTIVE check on the UT path.
Common situations: TM internal error or crash recovery in progress; a non-standard TM/UT implementation emitting invalid codes; transaction operations during shutdown.
Related errors
- TransactionManager reported transaction status as unknown
- JTA UserTransaction.begin() failed
- JTA UserTransaction.commit() failed
- JTA UserTransaction.rollback() failed
- JTA UserTransaction.getStatus() failed
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/155883b240cd3c70.
Report an issue: GitHub.