{"record":{"id":"8ae74ade4dc969d0","repo":"quarkusio/quarkus","slug":"multiple-checked-templates-exist-for-the-template","errorCode":null,"errorMessage":"Multiple checked templates exist for the template path %s:\n\t- %s: %s\n\t- %s","messagePattern":"Multiple checked templates exist for the template path (.+?):\n\t- (.+?): (.+?)\n\t- (.+?)","errorType":"exception","errorClass":"io.quarkus.qute.TemplateException","httpStatus":null,"severity":"error","filePath":"extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java","lineNumber":382,"sourceCode":"                if (method.returnType().kind() != Type.Kind.CLASS) {\n                    throw new TemplateException(\"Incompatible checked template return type: \" + method.returnType()\n                            + \" only \" + supportedAdaptors);\n                }\n                DotName returnTypeName = method.returnType().asClassType().name();\n                CheckedTemplateAdapter adaptor = null;\n                // if it's not the default template instance, try to find an adapter\n                if (!returnTypeName.equals(Names.TEMPLATE_INSTANCE)) {\n                    adaptor = adaptors.get(returnTypeName);\n                    if (adaptor == null)\n                        throw new TemplateException(\"Incompatible checked template return type: \" + method.returnType()\n                                + \" only \" + supportedAdaptors);\n                }\n                String fragmentId = getCheckedFragmentId(method, annotation);\n                String templatePath = getCheckedTemplatePath(index.getIndex(), annotation, fragmentId, targetClass, method);\n                String fullPath = templatePath + (fragmentId != null ? \"$\" + fragmentId : \"\");\n                AnnotationTarget checkedTemplate = checkedTemplates.putIfAbsent(fullPath, method);\n                if (checkedTemplate != null) {\n                    throw new TemplateException(\n                            String.format(\n                                    \"Multiple checked templates exist for the template path %s:\\n\\t- %s: %s\\n\\t- %s\",\n                                    fullPath, method.declaringClass().name(), method,\n                                    checkedTemplate));\n                }\n                if (!filePaths.contains(templatePath)\n                        && isNotLocatedByCustomTemplateLocator(locatorPatternsBuildItem.getLocationPatterns(),\n                                templatePath)) {\n                    List<String> startsWith = new ArrayList<>();\n                    for (String filePath : filePaths.getFilePaths()) {\n                        if (filePath.startsWith(templatePath)\n                                && filePath.charAt(templatePath.length()) == '.') {\n                            startsWith.add(filePath);\n                        }\n                    }\n                    if (startsWith.isEmpty()) {\n                        throw new TemplateException(\n                                \"No template matching the path \" + templatePath + \" could be found for: \"","sourceCodeStart":364,"sourceCodeEnd":400,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java#L364-L400","documentation":"Each template path may be bound to exactly one @CheckedTemplate method. When two methods (possibly in different classes) map to the same full template path (including fragment id), Qute cannot decide which one owns it and throws TemplateException listing both.","triggerScenarios":"Two @CheckedTemplate methods resolving to the same template path — e.g. nested Templates classes with identical basePath, or same method name in nested/inner template classes, or duplicate fragment ids.","commonSituations":"Inner static Templates classes in different classes sharing the same @CheckedTemplate basePath; copying a Templates class; method renames colliding with existing keys; same template accessed via two checked APIs.","solutions":["Rename one of the conflicting methods or move it so paths differ","Use a distinct basePath in the @CheckedTemplate annotation of one class","Delete the duplicate method if it is redundant"],"exampleFix":"// before\nclass A { @CheckedTemplate(basePath=\"item\") static native TemplateInstance page(); }\nclass B { @CheckedTemplate(basePath=\"item\") static native TemplateInstance page(); }\n// after\nclass B { @CheckedTemplate(basePath=\"item2\") static native TemplateInstance page(); }\n","handlingStrategy":"validation","validationCode":"// Detect duplicate template paths in a test\nSet<String> seen = new HashSet<>();\nfor (Class<?> c : List.of(A.Templates.class, B.Templates.class)) {\n    for (Method m : c.getDeclaredMethods()) {\n        if (m.isAnnotationPresent(CheckedTemplate.class)\n            && !seen.add(c.getSimpleName() + \".\" + m.getName()))\n            throw new IllegalStateException(\"Duplicate template binding: \" + m);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Give each Templates inner class a unique basePath","Never copy Templates classes between packages without renaming","Search codebase for existing bindings before adding new ones"],"tags":["qute","checked-templates","duplicate"],"backgroundTag":"duplicate-template-binding","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}