quarkusio/quarkus · error · IllegalStateException

It is not possible to specify multiple creation methods

Error message

It is not possible to specify multiple creation methods

What it means

SyntheticBeanBuildItem's configurator allows exactly one creation mechanism. checkMultipleCreationMethods() is called by supplier(), runtimeValue(), createWith() and runtimeProxy(), and throws IllegalStateException if any creation method was already set, preventing ambiguous bean instantiation strategies.

Source

Thrown at extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/SyntheticBeanBuildItem.java:298

        }

        Function<SyntheticCreationalContext<?>, ?> getFunction() {
            return fun;
        }

        Object getRuntimeProxy() {
            return runtimeProxy;
        }

        Supplier<ActiveResult> getCheckActive() {
            return checkActive;
        }

        private void checkMultipleCreationMethods() {
            if (runtimeProxy == null && runtimeValue == null && supplier == null && fun == null) {
                return;
            }
            throw new IllegalStateException("It is not possible to specify multiple creation methods");
        }

        private void checkReturnedProxy(Object object) {
            if (object instanceof ReturnedProxy) {
                return;
            }
            throw new IllegalArgumentException(
                    "The object is not a proxy returned from a recorder method: " + object.toString());
        }

    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Keep only one creation call — remove the redundant .supplier()/.runtimeValue()/.createWith()/.runtimeProxy()
  2. If both flavors are needed, build two separate SyntheticBeanBuildItems or choose one mechanism
  3. Wrap configuration in a single method so creation is set exactly once
  4. Review the diff for duplicated chained calls on the same configurator

Example fix

// before
configure(Foo.class).supplier(recorder.foo()).runtimeValue(recorder.fooValue()).done();
// after
configure(Foo.class).supplier(recorder.foo()).done();
Defensive patterns

Strategy: validation

Validate before calling

int creationCalls = countOf(supplier, runtimeValue, createWith, runtimeProxy); // keep == 1

Prevention

When it happens

Trigger: Calling two or more of .supplier(), .runtimeValue(), .createWith(), or .runtimeProxy() on the same ExtendedBeanConfigurator before done().

Common situations: Copy-pasting configurator chains from other extensions; merging two bean registrations during refactoring; conditional code that adds a runtimeValue on top of an existing supplier.

Related errors


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