quarkusio/quarkus · error · UnsupportedOperationException

Managed operations not supported

Error message

Managed operations not supported

What it means

StatelessReactiveOperations is the stateless (StatelessSession-backed) operations facade. getSession(entityClass) returns the underlying stateful Mutiny.Session, which a stateless facade does not have — the implementation throws UnsupportedOperationException (marked FIXME). Only getStatelessSession is meaningful here.

Source

Thrown at extensions/data/hibernate/runtime/src/main/java/io/quarkus/data/hibernate/runtime/hr/StatelessReactiveOperations.java:26

import org.hibernate.reactive.mutiny.Mutiny;

import io.quarkus.data.hibernate.reactive.ReactiveDataQuery;
import io.quarkus.data.hibernate.runtime.spi.PanacheReactiveOperations;
import io.smallrye.mutiny.Uni;

public class StatelessReactiveOperations implements PanacheReactiveOperations {

    public final static StatelessReactiveOperations INSTANCE = new StatelessReactiveOperations();
    private final static StatelessReactiveJpaOperations DELEGATE = new StatelessReactiveJpaOperations();

    private StatelessReactiveOperations() {
    }

    @Override
    public Uni<Mutiny.Session> getSession(Class<?> entityClass) {
        // FIXME: this is wrong
        throw new UnsupportedOperationException("Managed operations not supported");
    }

    @Override
    public Uni<Mutiny.StatelessSession> getStatelessSession(Class<?> entityClass) {
        // FIXME: this is wrong
        return DELEGATE.getSession();
    }

    @Override
    public Uni<Void> insert(Object entity) {
        return DELEGATE.insert(entity);
    }

    @Override
    public Uni<Void> persist(Object entity) {
        throw new UnsupportedOperationException("Managed operations not supported");
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Call getStatelessSession(entityClass) to access the underlying Mutiny.StatelessSession instead
  2. Perform the needed operation through the stateless operations API (list/insert/update/delete) rather than raw session access
  3. Switch the execution mode to managed sessions if you genuinely need a Mutiny.Session

Example fix

// before
Uni<Mutiny.Session> s = statelessOps.getSession(Entity.class);
// after
Uni<Mutiny.StatelessSession> ss = statelessOps.getStatelessSession(Entity.class);
Defensive patterns

Strategy: validation

Validate before calling

if (ops instanceof StatelessReactiveOperations) { throw new IllegalStateException("getSession() unavailable in stateless mode; use getStatelessSession()"); }

Type guard

boolean hasManagedSession(Object ops) { return !(ops instanceof StatelessReactiveOperations); }

Try / catch

try { ops.getSession(Entity.class); } catch (UnsupportedOperationException e) { ops.getStatelessSession(Entity.class); }

Prevention

When it happens

Trigger: Calling getSession(Class) on StatelessReactiveOperations (e.g. via ReactiveOperations.getSession when the active mode is stateless, such as quarkus.hibernate-orm active stateless session usage).

Common situations: Code that needs raw session access (native queries, session-level operations) running under stateless session mode where only StatelessSession is available; shared repository base classes assuming a managed session is always present.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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