quarkusio/quarkus · error · IllegalArgumentException
Unrecognized mode '<mode>', supported values are test, dev,
Error message
Unrecognized mode '<mode>', supported values are test, dev, development, prod
What it means
GoOfflineMojo accepts a `mode` parameter (test, dev/development, prod) that decides which dependency scopes are excluded when pre-downloading everything for offline builds. An unrecognized value throws this IllegalArgumentException. Empty string is treated as prod.
Source
Thrown at devtools/maven/src/main/java/io/quarkus/maven/GoOfflineMojo.java:100
boolean useLegacy = BootstrapAppModelResolver.isLegacyModelResolver(project.getProperties());
final BootstrapAppModelResolver appModelResolver = new BootstrapAppModelResolver(resolver)
.setLegacyModelResolver(useLegacy);
final Set<String> excludedScopes;
if (mode.equals("all")) {
appModelResolver.setDevMode(true);
appModelResolver.setTest(true);
excludedScopes = Set.of();
} else if (mode.equalsIgnoreCase("test")) {
appModelResolver.setTest(true);
excludedScopes = Set.of();
} else if (mode.equalsIgnoreCase("dev") || mode.equalsIgnoreCase("development")) {
appModelResolver.setDevMode(true);
excludedScopes = Set.of("test");
} else if (mode.equalsIgnoreCase("prod") || mode.isEmpty()) {
excludedScopes = Set.of("test", "provided");
} else {
throw new IllegalArgumentException(
"Unrecognized mode '" + mode + "', supported values are test, dev, development, prod");
}
final DependencyNode root;
try {
root = resolver.getSystem().collectDependencies(
resolver.getSession(),
resolver.newCollectManagedRequest(pom, List.of(), List.of(), List.of(), List.of(), excludedScopes))
.getRoot();
} catch (Exception e) {
throw new MojoExecutionException("Failed to collect dependencies of " + pom, e);
}
final LocalWorkspace workspace = resolver.getMavenContext().getWorkspace();
final List<Path> createdDirs = new ArrayList<>(workspace.getProjects().size());
try {
ensureResolvableModule(root, workspace, createdDirs);
appModelResolver.resolveModel(ArtifactCoords.of(pom.getGroupId(), pom.getArtifactId(), pom.getClassifier(),View on GitHub (pinned to e1c734241f)
Solutions
- Use one of: -Dmode=test, -Dmode=dev, -Dmode=development, or -Dmode=prod (or omit -Dmode for prod default)
- Correct CI scripts to pass 'prod' instead of 'production'
- Trim/guard the mode variable in scripts so whitespace or wrong values are not passed
Example fix
// before mvn quarkus:go-offline -Dmode=production // after mvn quarkus:go-offline -Dmode=prod
Defensive patterns
Strategy: validation
Validate before calling
case "$MODE" in test|dev|development|prod|"") : ;; *) echo "invalid -Dmode=$MODE"; exit 1;; esac
Prevention
- Use only test, dev, development, or prod for -Dmode
- Default to omitting -Dmode for prod behavior
- Validate the mode variable in CI scripts before invoking go-offline
When it happens
Trigger: Running `mvn quarkus:go-offline -Dmode=<value>` where <value> is not test, dev, development, or prod (case-insensitive) — e.g. -Dmode=production or -Dmode=Test-Only.
Common situations: Typo in the -Dmode property; assuming 'production' or 'runtime' are valid aliases; CI scripts passing a variable that is empty-but-whitespace or a stale value from an older plugin version.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Unsupported format: ${format}
- Either the `extension` or `extensions` parameter must be set
- Cannot specify both class and method name
- The project artifact's extension is '${extension}' while thi
- Specifying a stream requires the Quarkus extension registry
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/93ecb2b979b63ef3.
Report an issue: GitHub.