quarkusio/quarkus · error · IllegalStateException

Method ${class}.${method} is suspendable but kotlinx-corouti

Error message

Method ${class}.${method} is suspendable but kotlinx-coroutines-jdk8 dependency not detected

What it means

A Kotlin suspend mediator method was found, but the kotlinx-coroutines-jdk8 dependency (provided by quarkus-kotlin / coroutine CDI support) is not on the classpath, so Quarkus cannot build the coroutine invoker. The deployment fails with the offending class/method named.

Source

Thrown at extensions/smallrye-reactive-messaging/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/deployment/SmallRyeReactiveMessagingProcessor.java:620

                            "io.quarkus.smallrye.reactivemessaging.runtime.kotlin.ApplicationCoroutineScope")
                    .setUnremovable().build());
        }
    }

    @BuildStep
    void configCustomizer(BuildProducer<ServiceProviderBuildItem> serviceProvider) {
        // Config mapping between SmallRye / MP and Quarkus
        serviceProvider.produce(ServiceProviderBuildItem
                .allProvidersFromClassPath(ReactiveMessagingConfigBuilderCustomizer.class.getName()));
    }

    private void ensureKotlinCoroutinesEnabled(CoroutineConfigurationBuildItem coroutineConfigurationBuildItem,
            MethodInfo method) {
        if (!coroutineConfigurationBuildItem.isEnabled()) {
            String format = String.format(
                    "Method %s.%s is suspendable but kotlinx-coroutines-jdk8 dependency not detected",
                    method.declaringClass().name(), method.name());
            throw new IllegalStateException(format);
        }
    }

    public static final class CoroutineConfigurationBuildItem extends SimpleBuildItem {
        private final boolean isEnabled;

        public CoroutineConfigurationBuildItem(boolean isEnabled) {
            this.isEnabled = isEnabled;
        }

        public boolean isEnabled() {
            return isEnabled;
        }
    }

    @BuildStep
    void duplicatedContextSupport(CombinedIndexBuildItem index, BuildProducer<AdditionalBeanBuildItem> beans,
            BuildProducer<AnnotationsTransformerBuildItem> transformations) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Add the quarkus-kotlin extension dependency (which brings kotlinx-coroutines-jdk8).
  2. Explicitly add org.jetbrains.kotlinx:kotlinx-coroutines-jdk8 to the pom.xml/build.gradle.
  3. Remove `suspend` from the method if coroutines are not intended.

Example fix

// before
<dependency>io.quarkus:quarkus-smallrye-reactive-messaging</dependency>
// after
<dependency>io.quarkus:quarkus-smallrye-reactive-messaging</dependency>
<dependency>io.quarkus:quarkus-kotlin</dependency>
Defensive patterns

Strategy: validation

Validate before calling

// pom.xml check before adding suspend mediators:
// <dependency>
//   <groupId>io.quarkus</groupId>
//   <artifactId>quarkus-kotlin</artifactId>
// </dependency>

Prevention

When it happens

Trigger: Using `suspend` in a Reactive Messaging mediator class in a project that lacks quarkus-kotlin (or kotlinx-coroutines) dependency, so CoroutineConfigurationBuildItem.isEnabled() is false.

Common situations: Adding Kotlin reactive-messaging code to a Java-first app without adding quarkus-kotlin; removing the kotlinx-coroutines-jdk8 dependency during dependency cleanup.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


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