quarkusio/quarkus · error · MessageBundleException

A message bundle interface method must not use the key 'mess

Error message

A message bundle interface method must not use the key 'message' which is reserved for dynamic lookup; defined for %s#%s()

What it means

The key 'message' is reserved by Qute for dynamic message lookup ({msg:message(key)}). A bundle interface method whose derived key (from method name or @Message#key) equals 'message' would collide with this reserved mechanism, so the build fails for that method.

Source

Thrown at extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleProcessor.java:1065

                                method.parameterTypes().toArray(new Type[] {}));
                        if (defaultBundleMethod == null) {
                            throw new MessageBundleException(
                                    String.format("Default bundle method not found on %s: %s", bundleInterface, method));
                        }
                        messageAnnotation = defaultBundleMethod.annotation(Names.MESSAGE);
                    } else {
                        messageAnnotation = method.annotation(Names.MESSAGE);
                    }

                    if (messageAnnotation == null) {
                        LOG.debugf("@Message not declared on %s#%s - using the default key/value", bundleInterface, method);
                        messageAnnotation = AnnotationInstance.builder(Names.MESSAGE).value(Message.DEFAULT_VALUE)
                                .add("name", Message.DEFAULT_NAME).build();
                    }

                    String key = getKey(method, messageAnnotation, defaultKeyValue);
                    if (key.equals(MESSAGE)) {
                        throw new MessageBundleException(String.format(
                                "A message bundle interface method must not use the key 'message' which is reserved for dynamic lookup; defined for %s#%s()",
                                bundleInterface, method.name()));
                    }
                    if (keyMap.containsKey(key)) {
                        throw new MessageBundleException(String.format("Duplicate key [%s] found on %s", key, bundleInterface));
                    }
                    keyMap.put(key, new SimpleMessageMethod(method));

                    boolean generatedTemplate = false;
                    String messageTemplate = messageTemplates.get(method.name());
                    if (messageTemplate == null) {
                        messageTemplate = getMessageAnnotationValue(messageAnnotation, true);
                    }

                    if (messageTemplate == null && defaultBundleInterface != null) {
                        // method is annotated with @Message without value() -> fallback to default locale
                        messageTemplate = getMessageAnnotationValue((defaultBundleInterface.method(method.name(),
                                method.parameterTypes().toArray(new Type[] {}))).annotation(Names.MESSAGE), true);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Rename the method (e.g. `getMessage()`) or change its @Message key to something other than 'message'.
  2. If dynamic lookup is intended, remove the method and use `{msg:message('some.key')}` in templates instead.
  3. Rebuild after the rename to confirm uniqueness against the reserved key.

Example fix

// before
@Message(key = "message")
String message();

// after
@Message("Fallback message")
String fallbackMessage();
Defensive patterns

Strategy: validation

Validate before calling

// Reject methods resolving to the reserved key 'message'
for (java.lang.reflect.Method m : AppMessages.class.getDeclaredMethods()) {
    Message msg = m.getAnnotation(Message.class);
    String key = (msg != null && !Message.DEFAULT_NAME.equals(msg.key())) ? msg.key() : m.getName();
    if ("message".equals(key)) throw new IllegalStateException("Reserved key on: " + m);
}

Prevention

When it happens

Trigger: Declaring a bundle method named `message()` or annotating a method with `@Message(key = "message")`.

Common situations: Naming a method after a generic concept ('message', 'text'); migrating from frameworks where 'message' was a legal key; writing a catch-all lookup method intending dynamic behavior but statically defined instead.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/9210a4e4f6510147. Report an issue: GitHub.