quarkusio/quarkus · error · MojoExecutionException
Parameter 'mode' was set to '<mode>' while expected one of '
Error message
Parameter 'mode' was set to '<mode>' while expected one of 'dev', 'test' or 'prod'
What it means
DependencyTreeMojo accepts a `mode` parameter that selects how the application model is resolved (test, dev, or prod). Only 'dev'/'development', 'test', 'prod', or empty are accepted; anything else throws MojoExecutionException. This validates user configuration before resolving the model.
Source
Thrown at devtools/maven/src/main/java/io/quarkus/maven/DependencyTreeMojo.java:152
private void logTree(final Consumer<String> log) throws MojoExecutionException {
log.accept("Quarkus application " + mode.toUpperCase() + " mode build dependency tree:");
final ArtifactCoords appArtifact = ArtifactCoords.pom(project.getGroupId(), project.getArtifactId(),
project.getVersion());
final BootstrapAppModelResolver modelResolver;
try {
modelResolver = new BootstrapAppModelResolver(resolver())
.setRuntimeModelOnly(runtimeOnly);
if (mode != null) {
if (mode.equalsIgnoreCase("test")) {
modelResolver.setTest(true);
} else if (mode.equalsIgnoreCase("dev") || mode.equalsIgnoreCase("development")) {
modelResolver.setDevMode(true);
} else if (mode.equalsIgnoreCase("prod") || mode.isEmpty()) {
// ignore, that's the default
} else {
throw new MojoExecutionException(
"Parameter 'mode' was set to '" + mode + "' while expected one of 'dev', 'test' or 'prod'");
}
}
modelResolver.setLegacyModelResolver(BootstrapAppModelResolver.isLegacyModelResolver(project.getProperties()));
modelResolver.setDepLogConfig(DependencyLoggingConfig.builder()
.setMessageConsumer(log)
.setVerbose(verbose)
.setGraph(graph)
.build());
modelResolver.resolveModel(appArtifact);
} catch (Exception e) {
throw new MojoExecutionException("Failed to resolve application model " + appArtifact + " dependencies", e);
}
}
protected MavenArtifactResolver resolver() {
return resolver == null
? resolver = workspaceProvider.createArtifactResolver(BootstrapMavenContext.config()View on GitHub (pinned to e1c734241f)
Solutions
- Set -Dmode to exactly one of dev, test, or prod.
- Remove the -Dmode property entirely to use the default (prod).
- Fix typos such as 'prodction' or 'Development ' (trailing spaces) in the Maven command or pom configuration.
- In CI, verify the variable being interpolated into -Dmode contains only the allowed values.
Example fix
// before mvn quarkus:dependency-tree -Dmode=production // after mvn quarkus:dependency-tree -Dmode=prod
Defensive patterns
Strategy: validation
Validate before calling
// validate the mode value before invoking Maven
String mode = System.getProperty("mode", "");
if (!(mode.isEmpty() || Set.of("dev","development","test","prod").contains(mode.toLowerCase()))) {
throw new IllegalArgumentException("mode must be dev, test or prod, got: " + mode);
} Prevention
- Only pass dev, test, or prod to -Dmode.
- Omit -Dmode entirely when prod (default) is desired.
- Keep mode values in a controlled variable/parameter list in CI scripts.
When it happens
Trigger: Running `mvn quarkus:dependency-tree -Dmode=<value>` with a value other than dev/development/test/prod/empty, e.g. a typo like 'prodction', 'DEV-MODE', or 'qa'.
Common situations: Typos in the -Dmode property; copying a mode value from another tool (e.g. 'integration' or 'staging' profiles); CI scripts parameterized with an unexpected default value; shell variable expanding to empty-quoted or whitespace text.
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
- Maven version can't be empty.
- Unrecognized dependency flag '<trimmed>'. Supported flags: O
- Parameter 'mode' was set to '<mode>' while expected one of '
- Parameter 'mode' was set to '<mode>' while expected one of '
- Top-level project base directory <dir> specified with system
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/a579447c13a4b0fd.
Report an issue: GitHub.