{"record":{"id":"c5f42724401b75a2","repo":"quarkusio/quarkus","slug":"enum-constant-message-not-found-in-bundle-s-for","errorCode":null,"errorMessage":"Enum constant message not found in bundle [%s] for key: %s","messagePattern":"Enum constant message not found in bundle \\[(.+?)\\] for key: (.+?)","errorType":"exception","errorClass":"TemplateException","httpStatus":null,"severity":"error","filePath":"extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleProcessor.java","lineNumber":1113,"sourceCode":"                    if (messageTemplate == null && method.parametersCount() == 1) {\n                        Type paramType = method.parameterType(0);\n                        if (paramType.kind() == org.jboss.jandex.Type.Kind.CLASS) {\n                            ClassInfo maybeEnum = index.getClassByName(paramType.name());\n                            if (maybeEnum != null && maybeEnum.isEnum()) {\n                                StringBuilder generatedMessageTemplate = new StringBuilder(\"{#when \")\n                                        .append(getParameterName(method, 0))\n                                        .append(\"}\");\n                                Set<String> enumConstants = maybeEnum.fields().stream().filter(FieldInfo::isEnumConstant)\n                                        .map(FieldInfo::name).collect(Collectors.toSet());\n                                String separator = enumConstantSeparator(enumConstants);\n                                for (String enumConstant : enumConstants) {\n                                    // myEnum_CONSTANT\n                                    // myEnum_$CONSTANT_1\n                                    // myEnum_$CONSTANT$NEXT\n                                    String enumConstantKey = toEnumConstantKey(method.name(), separator, enumConstant);\n                                    String enumConstantTemplate = messageTemplates.get(enumConstantKey);\n                                    if (enumConstantTemplate == null) {\n                                        throw new TemplateException(\n                                                String.format(\"Enum constant message not found in bundle [%s] for key: %s\",\n                                                        bundleName + (locale != null ? \"_\" + locale : \"\"), enumConstantKey));\n                                    }\n                                    generatedMessageTemplate.append(\"{#is \")\n                                            .append(enumConstant)\n                                            .append(\"}{\")\n                                            .append(bundle.getName())\n                                            .append(\":\")\n                                            .append(enumConstantKey)\n                                            .append(\"}\");\n                                    // For each constant we generate a method:\n                                    // myEnum_CONSTANT(MyEnum val)\n                                    // myEnum_$CONSTANT_1(MyEnum val)\n                                    // myEnum_$CONSTANT$NEXT(MyEnum val)\n                                    generateEnumConstantMessageMethod(cc, bundleName, locale, bundleInterface,\n                                            defaultBundleInterface, enumConstantKey, keyMap, enumConstantTemplate,\n                                            messageTemplateMethods);\n                                }","sourceCodeStart":1095,"sourceCodeEnd":1131,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleProcessor.java#L1095-L1131","documentation":"During message bundle processing, Qute generates a switch/select template over enum constants for localized enum messages. For each constant it looks up a message template by a derived key (e.g. myEnum_CONSTANT); if no template with that key exists in the bundle, the deployment fails with this TemplateException.","triggerScenarios":"A @MessageBundle interface method takes an enum parameter and is used for enum localization, but a @Message/bundle template does not exist for one or more enum constants of that enum (key derived from bundle method name + separator + constant name).","commonSituations":"Adding a new enum constant to an existing localized enum without adding the corresponding bundle message; typos in the message key; renaming a constant without updating the bundle.","solutions":["Add a message template for the missing enum constant key shown in the error message to the bundle interface or properties file","Regenerate the key mentally: bundleMethodName + separator (usually '_') + ENUM_CONSTANT, and make sure it matches exactly","Remove the enum constant from the enum or stop localizing that enum if the message is not needed"],"exampleFix":"// before (enum Color { RED, GREEN }, missing GREEN)\n@Message(\"color = {myEnum}\")\nString colorName(Color myEnum);\n// after\n@Message(\"red\")\nString colorName_red(); // keys: colorName_red, colorName_green per constant convention\n","handlingStrategy":"validation","validationCode":"// Build-time failure; validate constants before deploy\nfor (Color c : Color.values()) {\n    String key = \"colorName_\" + c.name();\n    if (!bundleKeys.contains(key)) throw new IllegalStateException(\"Missing bundle key: \" + key);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add a unit test enumerating all enum constants and asserting a bundle key exists for each","Keep enum constants and bundle keys reviewed together in PRs","Avoid '_' and '$' in localized enum constant names"],"tags":["qute","message-bundle","enum-localization","i18n"],"backgroundTag":"missing-message-bundle-key","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"}