quarkusio/quarkus · error · MojoExecutionException

Unrecognized dependency flag '<trimmed>'. Supported flags: O

Error message

Unrecognized dependency flag '<trimmed>'. Supported flags: OPTIONAL, DIRECT, RUNTIME_CP, DEPLOYMENT_CP, RUNTIME_EXTENSION_ARTIFACT, WORKSPACE_MODULE, RELOADABLE, TOP_LEVEL_RUNTIME_EXTENSION_ARTIFACT, CLASSLOADER_PARENT_FIRST, CLASSLOADER_RUNNER_PARENT_FIRST, CLASSLOADER_LESSER_PRIORITY, COMPILE_ONLY

What it means

DependencyListMojo.parseFlags converts a comma-separated dependency-flags string into a bitmask using the known FLAG_NAMES table (OPTIONAL, DIRECT, RUNTIME_CP, DEPLOYMENT_CP, RUNTIME_EXTENSION_ARTIFACT, WORKSPACE_MODULE, RELOADABLE, TOP_LEVEL_RUNTIME_EXTENSION_ARTIFACT, CLASSLOADER_PARENT_FIRST, CLASSLOADER_RUNNER_PARENT_FIRST, CLASSLOADER_LESSER_PRIORITY, COMPILE_ONLY). An unknown token throws a MojoExecutionException listing all supported flags.

Source

Thrown at devtools/maven/src/main/java/io/quarkus/maven/DependencyListMojo.java:210

        lines.sort(null);
        for (String line : lines) {
            log.accept(line);
        }
    }

    private int parseFlags() throws MojoExecutionException {
        if (flags == null || flags.isBlank()) {
            return 0;
        }
        int result = 0;
        for (String name : flags.split(",")) {
            final String trimmed = name.trim();
            if (trimmed.isEmpty()) {
                continue;
            }
            final Integer flagValue = FLAG_NAMES.get(trimmed.toLowerCase(Locale.ROOT));
            if (flagValue == null) {
                throw new MojoExecutionException(
                        "Unrecognized dependency flag '" + trimmed + "'. Supported flags: " + String.join(", ",
                                "OPTIONAL", "DIRECT", "RUNTIME_CP", "DEPLOYMENT_CP",
                                "RUNTIME_EXTENSION_ARTIFACT", "WORKSPACE_MODULE", "RELOADABLE",
                                "TOP_LEVEL_RUNTIME_EXTENSION_ARTIFACT", "CLASSLOADER_PARENT_FIRST",
                                "CLASSLOADER_RUNNER_PARENT_FIRST", "CLASSLOADER_LESSER_PRIORITY",
                                "COMPILE_ONLY"));
            }
            result |= flagValue;
        }
        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())

View on GitHub (pinned to e1c734241f)

Solutions

  1. Correct the flag spelling to one of the supported names listed in the error message
  2. Remove unsupported flags borrowed from other plugins
  3. Check the documentation of your Quarkus version for the exact supported flag set

Example fix

// before
mvn quarkus:dependency-list -Ddependencies.flags=runtime_cp,optional
// after
mvn quarkus:dependency-list -Ddependencies.flags=RUNTIME_CP,OPTIONAL
Defensive patterns

Strategy: validation

Validate before calling

// Validate the flags string against the supported set before invoking the goal
java.util.Set<String> SUPPORTED = java.util.Set.of("OPTIONAL", "DIRECT", "RUNTIME_CP", "DEPLOYMENT_CP",
        "RUNTIME_EXTENSION_ARTIFACT", "WORKSPACE_MODULE", "RELOADABLE",
        "TOP_LEVEL_RUNTIME_EXTENSION_ARTIFACT", "CLASSLOADER_PARENT_FIRST",
        "CLASSLOADER_RUNNER_PARENT_FIRST", "CLASSLOADER_LESSER_PRIORITY", "COMPILE_ONLY");
for (String token : flags.split(",")) {
    String t = token.trim();
    if (!t.isEmpty() && !SUPPORTED.contains(t.toUpperCase(java.util.Locale.ROOT))) {
        throw new IllegalStateException("Unsupported dependency flag: " + t);
    }
}

Try / catch

try {
    mojo.execute();
} catch (MojoExecutionException e) {
    if (e.getMessage().startsWith("Unrecognized dependency flag")) {
        // read the 'Supported flags:' list from the message and correct the value
    }
}

Prevention

When it happens

Trigger: Passing quarkus:dependency-list (or -D...flags style) configuration containing a flag token whose trimmed, lowercased value is not in FLAG_NAMES, e.g. -Ddependencies.flags=runtime,cp or a typo like DEPLOYEMNT_CP.

Common situations: Typos or wrong casing assumptions in flag names; using flags from maven-dependency-plugin (e.g. 'verbose', 'includeScope') that the Quarkus mojo does not support; older/newer Quarkus versions with a different flag set; commas vs other separators confusion.

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


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