{"record":{"id":"b49e2bf4d436c74e","repo":"quarkusio/quarkus","slug":"error-getting-the-status-of-the-current-transactio","errorCode":null,"errorMessage":"Error getting the status of the current transaction","messagePattern":"Error getting the status of the current transaction","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/context/TransactionContext.java","lineNumber":183,"sourceCode":"     */\n    @Override\n    public boolean isActive() {\n        Transaction transaction = getCurrentTransaction();\n        if (transaction == null) {\n            return false;\n        }\n\n        try {\n            int currentStatus = transaction.getStatus();\n            return currentStatus == Status.STATUS_ACTIVE ||\n                    currentStatus == Status.STATUS_MARKED_ROLLBACK ||\n                    currentStatus == Status.STATUS_PREPARED ||\n                    currentStatus == Status.STATUS_UNKNOWN ||\n                    currentStatus == Status.STATUS_PREPARING ||\n                    currentStatus == Status.STATUS_COMMITTING ||\n                    currentStatus == Status.STATUS_ROLLING_BACK;\n        } catch (SystemException e) {\n            throw new RuntimeException(\"Error getting the status of the current transaction\", e);\n        }\n    }\n\n    private Transaction getCurrentTransaction() {\n        try {\n            return transactionManager.get().getTransaction();\n        } catch (SystemException e) {\n            throw new RuntimeException(\"Error getting the current transaction\", e);\n        }\n    }\n\n    /**\n     * Representing of the context state. It's a container for all available beans in the context.\n     * It's filled during bean usage and cleared on destroy.\n     */\n    private static class TransactionContextState implements ContextState, Synchronization {\n\n        private final Lock lock = new ReentrantLock();","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/context/TransactionContext.java#L165-L201","documentation":"This RuntimeException wraps a jakarta.transaction.SystemException thrown by the transaction manager (Narayana) while reading the status of the transaction on the current thread. Quarkus's TransactionContext (the CDI transactional context) calls transactionManager.getStatus() to decide whether a transaction is active, and any low-level failure to query the status is rethrown as this unchecked exception. It signals a broken transaction manager or thread state, not a normal business condition.","triggerScenarios":"Calling TransactionContext.isActive(), get(), getState(), or destroy() when transactionManager.get().getStatus() throws SystemException — typically when the underlying Narayana TransactionManager is in an inconsistent/shut-down state or the thread is associated with a corrupted transaction.","commonSituations":"Application shutdown while a request thread still touches transactional CDI beans; arjuna object store corruption or permission problems; misconfigured transaction manager (e.g. bad object-store directory); multiple TransactionManagers on the classpath (duplicate narayana dependencies).","solutions":["Check quarkus.transaction.* configuration, especially the object store directory permissions/existence","Reproduce with debug logging (com.arjuna) to find the wrapped SystemException cause and fix that root cause","Remove duplicate/conflicting JTA/Narayana dependencies so only the Quarkus narayana-jta extension manages transactions","Ensure no transactional beans are accessed during/after shutdown (stop async work gracefully)"],"exampleFix":"// before: storing tx status checks in a @PreDestroy that runs after TM shutdown\n@PreDestroy void cleanup() { if (txContext.isActive()) { ... } }\n// after: guard with application state\n@PreDestroy void cleanup() { if (!shuttingDown && txContext.isActive()) { ... } }","handlingStrategy":"try-catch","validationCode":"// check TM health before transactional work\ntry {\n    int status = javax.naming... // or via UserTransaction\n    jakarta.transaction.Status status2 = transactionManager.getStatus();\n    // if this throws SystemException, TM is unhealthy\n} catch (SystemException e) { /* TM broken: alert/abort */ }","typeGuard":null,"tryCatchPattern":"try { txContext.isActive(); } catch (RuntimeException e) {\n    if (e.getCause() instanceof SystemException) { log.error(\"TM failure\", e); /* fail request / degrade */ }\n    throw e;\n}","preventionTips":["Validate quarkus.transaction.* config (object store path writable, unique node name) at deploy time","Avoid touching transactional beans in shutdown hooks","Keep only one JTA/Narayana implementation on the classpath","Monitor Narayana logs for SystemException early"],"tags":["jta","transaction","narayana","quarkus"],"backgroundTag":"transaction-manager-system-exception","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}