quarkusio/quarkus · error · IllegalArgumentException

Unexpected mode:

Error message

Unexpected mode: 

What it means

ApplicationDeploymentClasspathBuilder.getOriginalRuntimeClasspaths switches over the Quarkus build mode and builds the list of Gradle configurations to inspect (dev mode, test, prod). Any mode value outside the known enum constants hits the default branch, which throws IllegalArgumentException. This indicates an unknown/unhandled QuarkusMode was passed to the builder — normally impossible with the shipped enum, so it usually signals a plugin version mismatch or a bug.

Source

Thrown at devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java:157

    }

    private static Configuration[] getOriginalRuntimeClasspaths(Project project, LaunchMode mode) {
        List<String> configurationNames;
        switch (mode) {
            case TEST:
                configurationNames = List.of(JavaPlugin.TEST_RUNTIME_CLASSPATH_CONFIGURATION_NAME);
                break;
            case NORMAL:
                configurationNames = List.of(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME);
                break;
            case DEVELOPMENT:
                configurationNames = List.of(
                        ToolingUtils.DEV_MODE_CONFIGURATION_NAME,
                        JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME,
                        JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME);
                break;
            default:
                throw new IllegalArgumentException("Unexpected mode: " + mode);
        }
        ConfigurationContainer configContainer = project.getConfigurations();
        return configurationNames.stream()
                .map(configContainer::getByName)
                .toArray(Configuration[]::new);
    }

    private final Project project;
    private final LaunchMode mode;

    private final String runtimeConfigurationName;
    private final String platformConfigurationName;
    private final String deploymentConfigurationName;
    private final String compileOnlyConfigurationName;

    /**
     * The platform configuration updates the PlatformImports, but since the PlatformImports don't
     * have a place to be stored in the project, they're stored here. The way that extensions are

View on GitHub (pinned to e1c734241f)

Solutions

  1. Check the error's appended mode value and compare it with supported modes of your Quarkus version
  2. Align all Quarkus Gradle plugin artifacts to the same version (gradle-model, plugin, IDE plugin)
  3. Run ./gradlew --stop and clear the configuration cache to eliminate stale plugin classpaths
  4. If you use a Quarkus snapshot/PR build, either switch to a release or update all modules consistently
  5. File a Quarkus issue with the mode value if it comes from an unmodified released plugin

Example fix

// before (build.gradle mixing versions)
implementation 'io.quarkus:quarkus-gradle-model:3.99.0'
// after
plugins { id 'io.quarkus' version '3.99.0' } // let the plugin bring matching modules
Defensive patterns

Strategy: validation

Validate before calling

// only pass modes the tooling understands
if (mode != QuarkusMode.DEV && mode != QuarkusMode.TEST && mode != QuarkusMode.PROD) {
    throw new IllegalStateException("Unsupported mode for classpath building: " + mode);
}

Try / catch

try {
    builder.getOriginalRuntimeClasspathAsInput(project, mode);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Unexpected mode:")) {
        // align plugin versions or map the mode to a supported one
    } else throw e;
}

Prevention

When it happens

Trigger: Calling getOriginalRuntimeClasspathAsInput with a mode value not covered by the switch (a new/unknown Quarkus mode enum constant from a mismatched plugin version on the classpath).

Common situations: Mixing Quarkus Gradle plugin versions (e.g. a snapshot plugin with an older gradle-model on the classpath); IDE-sync plugins passing an outdated mode enum; custom forks that added a mode without updating this switch.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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