redisson/redisson · error · InvalidDataAccessApiUsageException

Not in transaction mode. Please invoke multi method

Error message

Not in transaction mode. Please invoke multi method

What it means

Error "Not in transaction mode. Please invoke multi method" thrown in redisson/redisson.

Source

Thrown at redisson-spring/redisson-spring-data/redisson-spring-data-25/src/main/java/org/redisson/spring/data/connection/RedissonConnection.java:1638

    }

    @Override
    public List<Object> exec() {
        if (isPipelinedAtomic()) {
            return null;
        }
        if (isQueueing()) {
            try {
                BatchResult<?> result = ((CommandBatchService)executorService).execute();
                filterResults(result);
                return (List<Object>) result.getResponses();
            } catch (Exception ex) {
                throw transform(ex);
            } finally {
                resetConnection();
            }
        } else {
            throw new InvalidDataAccessApiUsageException("Not in transaction mode. Please invoke multi method");
        }
    }

    protected void filterResults(BatchResult<?> result) {
        if (result.getResponses().isEmpty()) {
            return;
        }

        int t = 0;
        for (Integer index : indexToRemove) {
            index -= t;
            result.getResponses().remove((int)index);
            t++;
        }
        for (ListIterator<Object> iterator = (ListIterator<Object>) result.getResponses().listIterator(); iterator.hasNext();) {
            Object object = iterator.next();
            if (object instanceof String) {
                iterator.set(((String) object).getBytes());

View on GitHub (pinned to 91188987c2)

Solutions

  1. Call connection.multi() before executing commands intended for the transaction, and finish with exec() or discard().
  2. Check that the same connection instance that started the transaction is used for exec/discard.

When it happens

Trigger: Thrown when exec() is invoked without a preceding multi() call, i.e. the connection is not in transaction mode.

Common situations: See trigger scenarios.


AI-assisted analysis of redisson/redisson@91188987c2 (2026-08-14). Data as JSON: /api/errors/5e97e4a1da4739c9. Report an issue: GitHub.