{"record":{"id":"4151e32c1a5ffa38","repo":"quarkusio/quarkus","slug":"template-record-component-name-conflicts-with","errorCode":null,"errorMessage":"Template record component [<name>] conflicts with an interface method of <recordInterface>","messagePattern":"Template record component \\[<name>\\] conflicts with an interface method of <recordInterface>","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":497,"sourceCode":"                                        + recordClass.name());\n                    } else {\n                        throw new TemplateException(\n                                startsWith + \" match the path \" + templatePath\n                                        + \" but the file suffix is not configured via the quarkus.qute.suffixes property\");\n                    }\n                }\n\n                Map<String, String> bindings = new HashMap<>();\n                List<Type> parameters = canonicalConstructor.parameterTypes();\n                for (int i = 0; i < parameters.size(); i++) {\n                    Type type = parameters.get(i);\n                    String name = canonicalConstructor.parameterName(i);\n                    if (name == null) {\n                        throw new TemplateException(\"Parameter names not recorded for \" + recordClass.name()\n                                + \": compile the class with -parameters\");\n                    }\n                    if (reservedNames.contains(name)) {\n                        throw new TemplateException(\"Template record component [\" + name\n                                + \"] conflicts with an interface method of \" + recordInterface);\n                    }\n                    bindings.put(name, getCheckedTemplateParameterTypeName(type));\n                }\n                AnnotationValue requireTypeSafeExpressions = checkedTemplateAnnotation != null\n                        ? checkedTemplateAnnotation.value(CHECKED_TEMPLATE_REQUIRE_TYPE_SAFE)\n                        : null;\n                ret.add(new CheckedTemplateBuildItem(templatePath, fragmentId, bindings, null, recordClass,\n                        requireTypeSafeExpressions != null ? requireTypeSafeExpressions.asBoolean() : true));\n                transformers.produce(new BytecodeTransformerBuildItem(recordClass.name().toString(),\n                        new TemplateRecordEnhancer(recordInterface, recordClass, templatePath, fragmentId,\n                                canonicalConstructor.descriptor(), canonicalConstructor.parameters(),\n                                adaptors.get(recordInterfaceName))));\n            }\n        }\n\n        return ret;\n    }","sourceCodeStart":479,"sourceCodeEnd":515,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java#L479-L515","documentation":"When a template record implements (via its record interface) a @CheckedTemplate interface, Qute reserves the names of the interface's methods (plus template built-ins) for the interface bindings. A record component using one of these reserved names (e.g. 'toString', an interface method name like 'list', or built-in names such as 'inject'/'root') would clash at code-generation time, so collectCheckedTemplates fails the build.","triggerScenarios":"A record used as a template record has a component whose name equals an interface method of the checked-template interface it implements (checked against the reservedNames set built from recordInterface methods and Qute reserved names).","commonSituations":"Naming a record component 'name' or 'items' when the checked template interface declares a method with the same name; components mirroring built-in template keys; mechanical renames that collide with interface methods.","solutions":["Rename the record component (e.g. userName instead of name) and update the template placeholders accordingly","Rename or remove the conflicting interface method if it's not needed","Remove the redundant component if the value can come from the interface binding itself"],"exampleFix":"// before\nrecord item(String list) implements Templates.Item {}\n// after\nrecord item(String listItems) implements Templates.Item {} // update template: {listItems}","handlingStrategy":"validation","validationCode":"// check record component names against interface methods\njava.lang.reflect.RecordComponent[] comps = item.class.getRecordComponents();\nSet<String> reserved = new HashSet<>();\nfor (Method m : Templates.Item.class.getMethods()) reserved.add(m.getName());\nreserved.addAll(Set.of(\"inject\",\"root\",\"ort\",\"cdi\",\"noroot\",\"noinject\"));\nfor (RecordComponent rc : comps) {\n    if (reserved.contains(rc.getName())) {\n        throw new IllegalStateException(\"Reserved component name: \" + rc.getName());\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid naming record components like Qute built-ins (inject, root, cdi, ...) or like the interface's methods","Prefix component names when in doubt (e.g. itemName)","Update templates when renaming components","Keep record interfaces minimal to shrink the reserved-name set"],"tags":["qute","build-time","naming-conflict","records"],"backgroundTag":"qute-template-name-conflict","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"}