{"record":{"id":"63318bbaf652c561","repo":"quarkusio/quarkus","slug":"messagestarts-cannot-be-empty","errorCode":null,"errorMessage":"messageStarts cannot be empty","messagePattern":"messageStarts cannot be empty","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/logging/LogCleanupFilterBuildItem.java","lineNumber":30,"sourceCode":" * provided the message starts with <tt>messageStart</tt>.\n *\n * @author Stéphane Épardaud\n */\npublic final class LogCleanupFilterBuildItem extends MultiBuildItem {\n\n    private LogCleanupFilterElement filterElement;\n\n    public LogCleanupFilterBuildItem(String loggerName, String... messageStarts) {\n        this(loggerName, Arrays.asList(messageStarts));\n    }\n\n    public LogCleanupFilterBuildItem(String loggerName, Level targetLevel, String... messageStarts) {\n        this(loggerName, targetLevel, Arrays.asList(messageStarts));\n    }\n\n    public LogCleanupFilterBuildItem(String loggerName, List<String> messageStarts) {\n        if (messageStarts.isEmpty()) {\n            throw new IllegalArgumentException(\"messageStarts cannot be empty\");\n        }\n        this.filterElement = new LogCleanupFilterElement(loggerName, messageStarts);\n    }\n\n    public LogCleanupFilterBuildItem(String loggerName, Level targetLevel, List<String> messageStarts) {\n        if (messageStarts.isEmpty()) {\n            throw new IllegalArgumentException(\"messageStarts cannot be empty\");\n        }\n        this.filterElement = new LogCleanupFilterElement(loggerName, targetLevel, messageStarts);\n    }\n\n    public LogCleanupFilterElement getFilterElement() {\n        return filterElement;\n    }\n}\n","sourceCodeStart":12,"sourceCodeEnd":46,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/logging/LogCleanupFilterBuildItem.java#L12-L46","documentation":"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.","triggerScenarios":"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.","commonSituations":"Extension authors wiring log cleanup filters from configuration where the configured message prefixes are missing or blank, causing the list to end up empty.","solutions":["Pass at least one non-empty message start string to the constructor.","Guard the call site: only construct the build item when the list of message starts is non-empty.","Verify the source of the list (config property, constant) actually contains entries at build time."],"exampleFix":"// before\nList<String> starts = config.filterPrefixes(); // may be empty\nproduce(new LogCleanupFilterBuildItem(\"com.foo.Noisy\", starts));\n// after\nif (!starts.isEmpty()) {\n    produce(new LogCleanupFilterBuildItem(\"com.foo.Noisy\", starts));\n}","handlingStrategy":"validation","validationCode":"if (messageStarts == null || messageStarts.isEmpty()) {\n    throw new IllegalStateException(\"LogCleanupFilterBuildItem requires at least one message start\");\n}\nnew LogCleanupFilterBuildItem(loggerName, messageStarts);","typeGuard":null,"tryCatchPattern":"try {\n    produce(new LogCleanupFilterBuildItem(loggerName, messageStarts));\n} catch (IllegalArgumentException e) {\n    LOG.warnf(\"Skipping log cleanup filter for %s: %s\", loggerName, e.getMessage());\n}","preventionTips":["Always pass at least one literal message prefix in tests and examples.","Validate config-derived lists for emptiness before constructing build items.","Never spread a possibly-empty collection as varargs without an emptiness check."],"tags":["quarkus","build-time","logging","illegal-argument"],"backgroundTag":"empty-required-collection","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"}