{"record":{"id":"c918385c850845bd","repo":"quarkusio/quarkus","slug":"let-s-not-put-template-condition-on-qualifier-c","errorCode":null,"errorMessage":"Let's not put template condition on qualifier: + comparedVersionString","messagePattern":"Let's not put template condition on qualifier: \\+ comparedVersionString","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/reader/QuteCodestartFileReader.java","lineNumber":210,"sourceCode":"                            return CompletedStage.of(value.endsWith((String) e));\n                        });\n                    }\n\n                case \"compareVersionTo\":\n                    if (context.getParams().size() == 1) {\n                        return context.evaluate(context.getParams().get(0)).thenCompose(e -> {\n                            return CompletedStage.of(compareVersionTo(value, (String) e));\n                        });\n                    }\n                default:\n                    return Results.notFound(context);\n            }\n        }\n    }\n\n    static int compareVersionTo(String currentVersionString, String comparedVersionString) {\n        if (!VERSION_PATTERN.matcher(comparedVersionString).matches()) {\n            throw new IllegalArgumentException(\"Let's not put template condition on qualifier: \" + comparedVersionString);\n        }\n        return new ComparableVersion(currentVersionString).compareTo(new ComparableVersion(comparedVersionString));\n    }\n\n}\n","sourceCodeStart":192,"sourceCodeEnd":216,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/reader/QuteCodestartFileReader.java#L192-L216","documentation":"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.","triggerScenarios":"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.","commonSituations":"Writing version ranges or qualifier suffixes in template conditions; using non-numeric placeholders; copying SemVer-style strings into Quarkus codestart conditions.","solutions":["Use plain numeric dotted versions in conditions: e.g. '2.16.0' not '2.16.0.Final'","Remove qualifiers/suffixes from the compared version string in the template condition","Check VERSION_PATTERN in QuteCodestartFileReader for the accepted format before writing conditions"],"exampleFix":"// before\n{#if quarkus:version >= 1.13.Final}\n// after\n{#if quarkus:version >= 1.13.0}","handlingStrategy":"validation","validationCode":"if (!compared.matches(\"\\\\d+(\\\\.\\\\d+)*\")) throw new IllegalArgumentException(\"Plain versions only\");","typeGuard":null,"tryCatchPattern":"try { generate.generateProject(dir, data); }\ncatch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Let's not put template condition on qualifier\")) { /* fix condition */ }\n    else throw e;\n}","preventionTips":["Numeric dotted versions only in conditions","No qualifiers or ranges","Consult VERSION_PATTERN before authoring"],"tags":["versioning","validation","codestart","qute"],"backgroundTag":"invalid-version-qualifier","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}