quarkusio/quarkus · error · IllegalArgumentException

messageStarts cannot be empty

Error message

messageStarts cannot be empty

What it means

This IllegalArgumentException is thrown by the LogCleanupFilterBuildItem two-argument constructor (loggerName, messageStarts) when the messageStarts list is empty. A log cleanup filter must match at least one message prefix to be meaningful, so Quarkus rejects an empty list at build time rather than producing a no-op filter.

Source

Thrown at core/deployment/src/main/java/io/quarkus/deployment/logging/LogCleanupFilterBuildItem.java:30

 * provided the message starts with <tt>messageStart</tt>.
 *
 * @author Stéphane Épardaud
 */
public final class LogCleanupFilterBuildItem extends MultiBuildItem {

    private LogCleanupFilterElement filterElement;

    public LogCleanupFilterBuildItem(String loggerName, String... messageStarts) {
        this(loggerName, Arrays.asList(messageStarts));
    }

    public LogCleanupFilterBuildItem(String loggerName, Level targetLevel, String... messageStarts) {
        this(loggerName, targetLevel, Arrays.asList(messageStarts));
    }

    public LogCleanupFilterBuildItem(String loggerName, List<String> messageStarts) {
        if (messageStarts.isEmpty()) {
            throw new IllegalArgumentException("messageStarts cannot be empty");
        }
        this.filterElement = new LogCleanupFilterElement(loggerName, messageStarts);
    }

    public LogCleanupFilterBuildItem(String loggerName, Level targetLevel, List<String> messageStarts) {
        if (messageStarts.isEmpty()) {
            throw new IllegalArgumentException("messageStarts cannot be empty");
        }
        this.filterElement = new LogCleanupFilterElement(loggerName, targetLevel, messageStarts);
    }

    public LogCleanupFilterElement getFilterElement() {
        return filterElement;
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Pass at least one non-empty message start string to the constructor.
  2. Guard the call site: only construct the build item when the list of message starts is non-empty.
  3. Verify the source of the list (config property, constant) actually contains entries at build time.

Example fix

// before
List<String> starts = config.filterPrefixes(); // may be empty
produce(new LogCleanupFilterBuildItem("com.foo.Noisy", starts));
// after
if (!starts.isEmpty()) {
    produce(new LogCleanupFilterBuildItem("com.foo.Noisy", starts));
}
Defensive patterns

Strategy: validation

Validate before calling

if (messageStarts == null || messageStarts.isEmpty()) {
    throw new IllegalStateException("LogCleanupFilterBuildItem requires at least one message start");
}
new LogCleanupFilterBuildItem(loggerName, messageStarts);

Try / catch

try {
    produce(new LogCleanupFilterBuildItem(loggerName, messageStarts));
} catch (IllegalArgumentException e) {
    LOG.warnf("Skipping log cleanup filter for %s: %s", loggerName, e.getMessage());
}

Prevention

When it happens

Trigger: Calling new LogCleanupFilterBuildItem(String loggerName, List<String> messageStarts) with an empty list, e.g. new LogCleanupFilterBuildItem("com.foo.Bar", List.of()) or a list built from a config value that resolved to nothing.

Common situations: Extension authors wiring log cleanup filters from configuration where the configured message prefixes are missing or blank, causing the list to end up empty.

Related errors


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