{"record":{"id":"155883b240cd3c70","repo":"hibernate/hibernate-orm","slug":"usertransaction-reported-transaction-status-as-unk-155883","errorCode":null,"errorMessage":"UserTransaction reported transaction status as unknown","messagePattern":"UserTransaction reported transaction status as unknown","errorType":"exception","errorClass":"TransactionException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/resource/transaction/backend/jta/internal/JtaTransactionAdapterUserTransactionImpl.java","lineNumber":92,"sourceCode":"\t\t\t\tuserTransaction.rollback();\n\t\t\t\tJTA_LOGGER.calledUserTransactionRollback();\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmarkRollbackOnly();\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tthrow new TransactionException( \"JTA UserTransaction.rollback() failed\", e );\n\t\t}\n\t}\n\n\t@Override\n\t@Nonnull\n\tpublic TransactionStatus getStatus() {\n\t\ttry {\n\t\t\tfinal var status = StatusTranslator.translate( userTransaction.getStatus() );\n\t\t\tif ( status == null ) {\n\t\t\t\tthrow new TransactionException( \"UserTransaction reported transaction status as unknown\" );\n\t\t\t}\n\t\t\treturn status;\n\t\t}\n\t\tcatch (SystemException e) {\n\t\t\tthrow new TransactionException( \"JTA UserTransaction.getStatus() failed\", e );\n\t\t}\n\t}\n\n\t@Override\n\tpublic void markRollbackOnly(){\n\t\ttry {\n\t\t\tuserTransaction.setRollbackOnly();\n\t\t}\n\t\tcatch (SystemException e) {\n\t\t\tthrow new TransactionException( \"Unable to mark transaction for rollback only\", e );\n\t\t}\n\t}\n","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/resource/transaction/backend/jta/internal/JtaTransactionAdapterUserTransactionImpl.java#L74-L110","documentation":"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.","triggerScenarios":"UserTransaction.getStatus() returning STATUS_UNKNOWN or an unexpected code, hit from Transaction.getStatus() or from begin()'s NOT_ACTIVE check on the UT path.","commonSituations":"TM internal error or crash recovery in progress; a non-standard TM/UT implementation emitting invalid codes; transaction operations during shutdown.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (TransactionException e) {\n    // 'UserTransaction reported transaction status as unknown'\n    // Environment-level signal: report TM health, stop transaction work\n    alertOnTransactionManagerHealth(e);\n}","preventionTips":["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"],"tags":["jta","transactions","hibernate","usertransaction","status"],"backgroundTag":"transaction-status-unknown","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}