quarkusio/quarkus · error · RuntimeException

Error getting the status of the current transaction

Error message

Error getting the status of the current transaction

What it means

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.

Source

Thrown at extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/context/TransactionContext.java:183

     */
    @Override
    public boolean isActive() {
        Transaction transaction = getCurrentTransaction();
        if (transaction == null) {
            return false;
        }

        try {
            int currentStatus = transaction.getStatus();
            return currentStatus == Status.STATUS_ACTIVE ||
                    currentStatus == Status.STATUS_MARKED_ROLLBACK ||
                    currentStatus == Status.STATUS_PREPARED ||
                    currentStatus == Status.STATUS_UNKNOWN ||
                    currentStatus == Status.STATUS_PREPARING ||
                    currentStatus == Status.STATUS_COMMITTING ||
                    currentStatus == Status.STATUS_ROLLING_BACK;
        } catch (SystemException e) {
            throw new RuntimeException("Error getting the status of the current transaction", e);
        }
    }

    private Transaction getCurrentTransaction() {
        try {
            return transactionManager.get().getTransaction();
        } catch (SystemException e) {
            throw new RuntimeException("Error getting the current transaction", e);
        }
    }

    /**
     * Representing of the context state. It's a container for all available beans in the context.
     * It's filled during bean usage and cleared on destroy.
     */
    private static class TransactionContextState implements ContextState, Synchronization {

        private final Lock lock = new ReentrantLock();

View on GitHub (pinned to e1c734241f)

Solutions

  1. Check quarkus.transaction.* configuration, especially the object store directory permissions/existence
  2. Reproduce with debug logging (com.arjuna) to find the wrapped SystemException cause and fix that root cause
  3. Remove duplicate/conflicting JTA/Narayana dependencies so only the Quarkus narayana-jta extension manages transactions
  4. Ensure no transactional beans are accessed during/after shutdown (stop async work gracefully)

Example fix

// before: storing tx status checks in a @PreDestroy that runs after TM shutdown
@PreDestroy void cleanup() { if (txContext.isActive()) { ... } }
// after: guard with application state
@PreDestroy void cleanup() { if (!shuttingDown && txContext.isActive()) { ... } }
Defensive patterns

Strategy: try-catch

Validate before calling

// check TM health before transactional work
try {
    int status = javax.naming... // or via UserTransaction
    jakarta.transaction.Status status2 = transactionManager.getStatus();
    // if this throws SystemException, TM is unhealthy
} catch (SystemException e) { /* TM broken: alert/abort */ }

Try / catch

try { txContext.isActive(); } catch (RuntimeException e) {
    if (e.getCause() instanceof SystemException) { log.error("TM failure", e); /* fail request / degrade */ }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/b49e2bf4d436c74e. Report an issue: GitHub.