quarkusio/quarkus · error · IllegalArgumentException

Let's not put template condition on qualifier: + comparedVer

Error message

Let's not put template condition on qualifier: + comparedVersionString

What it means

compareVersionTo compares template condition versions using Maven ComparableVersion. Before comparing, the compared (right-hand) version string is validated against VERSION_PATTERN; anything that looks like a version qualifier (e.g. '1.0.Final', '2.x') is rejected with this IllegalArgumentException. Only plain version numbers are allowed in template conditions.

Source

Thrown at independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/reader/QuteCodestartFileReader.java:210

                            return CompletedStage.of(value.endsWith((String) e));
                        });
                    }

                case "compareVersionTo":
                    if (context.getParams().size() == 1) {
                        return context.evaluate(context.getParams().get(0)).thenCompose(e -> {
                            return CompletedStage.of(compareVersionTo(value, (String) e));
                        });
                    }
                default:
                    return Results.notFound(context);
            }
        }
    }

    static int compareVersionTo(String currentVersionString, String comparedVersionString) {
        if (!VERSION_PATTERN.matcher(comparedVersionString).matches()) {
            throw new IllegalArgumentException("Let's not put template condition on qualifier: " + comparedVersionString);
        }
        return new ComparableVersion(currentVersionString).compareTo(new ComparableVersion(comparedVersionString));
    }

}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Use plain numeric dotted versions in conditions: e.g. '2.16.0' not '2.16.0.Final'
  2. Remove qualifiers/suffixes from the compared version string in the template condition
  3. Check VERSION_PATTERN in QuteCodestartFileReader for the accepted format before writing conditions

Example fix

// before
{#if quarkus:version >= 1.13.Final}
// after
{#if quarkus:version >= 1.13.0}
Defensive patterns

Strategy: validation

Validate before calling

if (!compared.matches("\\d+(\\.\\d+)*")) throw new IllegalArgumentException("Plain versions only");

Try / catch

try { generate.generateProject(dir, data); }
catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Let's not put template condition on qualifier")) { /* fix condition */ }
    else throw e;
}

Prevention

When it happens

Trigger: A codestart template condition like {#if quarkus:version >= 2.0.Final} (or any condition operand not matching the strict numeric version pattern) is evaluated while rendering.

Common situations: Writing version ranges or qualifier suffixes in template conditions; using non-numeric placeholders; copying SemVer-style strings into Quarkus codestart conditions.

Related errors


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