quarkusio/quarkus · error · MessageBundleException
%s is not an enum constant of %s: %s
Error message
%s is not an enum constant of %s: %s
What it means
Qute supports per-enum-constant messages with keys of the form EnumName_CONSTANT or _$ prefix conventions. When isEnumConstantMessageKey resolves a key to an enum type, it verifies the constant actually exists as an enum constant field on that enum; if not, the build fails reporting the constant, the enum, and the key. This guards against typos in enum-constant message keys.
Source
Thrown at extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleProcessor.java:946
private boolean isEnumConstantMessageKey(String separator, String key, IndexView index, ClassInfo bundleInterface) {
int lastIdx = key.lastIndexOf(separator);
if (lastIdx != -1 && lastIdx != key.length()) {
String methodName = key.substring(0, lastIdx);
String constant = key.substring(lastIdx + separator.length(), key.length());
MethodInfo method = messageBundleMethod(bundleInterface, methodName);
if (method != null && method.parametersCount() == 1) {
Type paramType = method.parameterType(0);
if (paramType.kind() == org.jboss.jandex.Type.Kind.CLASS) {
ClassInfo maybeEnum = index.getClassByName(paramType.name());
if (maybeEnum != null && maybeEnum.isEnum()) {
if (maybeEnum.fields().stream()
.filter(FieldInfo::isEnumConstant)
.map(FieldInfo::name)
.anyMatch(constant::equals)) {
return true;
}
throw new MessageBundleException(
String.format("%s is not an enum constant of %s: %s", constant, maybeEnum, key));
}
}
}
}
return false;
}
private void constructLine(StringBuilder builder, Iterator<String> it) {
if (it.hasNext()) {
String nextLine = adaptLine(it.next());
if (nextLine.endsWith("\\")) {
builder.append(nextLine.substring(0, nextLine.length() - 1));
constructLine(builder, it);
} else {
builder.append(nextLine);
}
}View on GitHub (pinned to e1c734241f)
Solutions
- Fix the key in the properties file to use an existing enum constant, e.g. `Color_GREEN` instead of `Color_RED`.
- Or re-add the missing constant to the enum if it should exist.
- Regenerate/verify the list of constants against the enum source before re-building.
Example fix
// before (messages.properties)
Color_RED=Red color
// enum Color { GREEN, BLUE }
// after
Color_GREEN=Green color Defensive patterns
Strategy: validation
Validate before calling
// Verify enum-constant keys reference real constants
EnumMap-check: for key "Color_RED", assert
java.util.Arrays.stream(Color.values()).anyMatch(e -> e.name().equals("RED")); Prevention
- Regenerate per-constant keys when enum constants are renamed/removed
- Use IDE rename refactoring across properties files
- Keep enum message keys adjacent to the enum source in review
When it happens
Trigger: A properties key like `Color_RED` where Color enum has no RED constant (e.g. it is named `REDISH` or was renamed); key references a constant removed from the enum.
Common situations: Renaming or deleting enum constants without updating per-constant message keys in bundle properties files; misspelling the constant part of the key; copying keys between projects with slightly different enums.
Related errors
- Message bundle name [%s] declared on %s must be a valid name
- Message bundle interface name conflict - [%s] is used for bo
- Locale of [%s] conflicts with the locale [%s] of the default
- Cannot register [%s] - a localized message bundle interface
- @MessageBundle must be declared on an interface: {bundleClas
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/74a5451a60616bd1.
Report an issue: GitHub.