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
DependencyListMojo.resolveApplicationModel accepts a 'mode' parameter controlling the BootstrapAppModelResolver: test, dev/development, or prod (default/empty). Any other value throws a MojoExecutionException stating the invalid mode and the three accepted options.
Source
Thrown at devtools/maven/src/main/java/io/quarkus/maven/DependencyListMojo.java:237
}
return result;
}
private ApplicationModel resolveApplicationModel(int flags) throws MojoExecutionException {
final ArtifactCoords appArtifact = ArtifactCoords.pom(project.getGroupId(), project.getArtifactId(),
project.getVersion());
final BootstrapAppModelResolver modelResolver;
try {
modelResolver = new BootstrapAppModelResolver(resolver())
.setRuntimeModelOnly(((flags & DependencyFlags.RUNTIME_CP) > 0));
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()));
return 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()
.setUserSettings(session.getRequest().getUserSettingsFile())
.setRemoteRepositories(repos)
.setPreferPomsFromWorkspace(true))
: resolver;
}
}View on GitHub (pinned to e1c734241f)
Solutions
- Set mode to exactly one of dev, test, or prod (or leave it empty for prod)
- Use 'development' if you prefer the long form of dev
- Strip whitespace/quotes from the property in your CI script
Example fix
// before mvn quarkus:dependency-list -Dmode=production // after mvn quarkus:dependency-list -Dmode=prod
Defensive patterns
Strategy: validation
Validate before calling
// Validate the mode value before invoking the goal
java.util.Set<String> VALID = java.util.Set.of("dev", "development", "test", "prod", "");
if (!VALID.contains(mode == null ? "" : mode.trim())) {
throw new IllegalStateException("mode must be one of dev, test, prod (got: " + mode + ")");
} Try / catch
try {
mojo.execute();
} catch (MojoExecutionException e) {
if (e.getMessage().contains("Parameter 'mode' was set to")) {
// re-run with -Dmode=dev|test|prod
}
} Prevention
- Use only dev, test, or prod for -Dmode in all scripts and CI pipelines
- Remember 'development' is an accepted alias for dev, but 'production' is NOT accepted for prod
- Trim/quote-check dynamically computed mode values in CI
When it happens
Trigger: Running the goal with -Dmode=<value> (or pom config) set to something other than dev, development, test, prod, or empty — e.g. 'production', 'qa', or a misspelled value.
Common situations: Assuming 'production' works instead of 'prod'; passing environment names from other tooling (CI profiles); quoting/whitespace issues leaving stray characters in the mode value; upgrading from older versions with looser validation.
Related errors
- 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 '
- Manifest entry name ${key} is invalid. " characters are not
- Manifest section name ${section} is invalid. " characters ar
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/94aa646287497a1f.
Report an issue: GitHub.