{"record":{"id":"10b4545a33586c1c","repo":"quarkusio/quarkus","slug":"a-matching-predicate-must-be-set","errorCode":null,"errorMessage":"A matching predicate must be set!","messagePattern":"A matching predicate must be set!","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/AutoAddScopeBuildItem.java","lineNumber":309,"sourceCode":"\n        /**\n         * The final predicate is a short-circuiting logical AND of the previous predicate (if any) and this condition.\n         *\n         * @param other\n         * @return self\n         */\n        public Builder and(MatchPredicate other) {\n            if (matchPredicate == null) {\n                matchPredicate = other;\n            } else {\n                matchPredicate = matchPredicate.and(other);\n            }\n            return this;\n        }\n\n        public AutoAddScopeBuildItem build() {\n            if (matchPredicate == null) {\n                throw new IllegalStateException(\"A matching predicate must be set!\");\n            }\n            return new AutoAddScopeBuildItem(matchPredicate, requiresContainerServices, defaultScope, unremovable, reason,\n                    priority, scopeAlreadyAdded);\n        }\n    }\n\n}\n","sourceCodeStart":291,"sourceCodeEnd":317,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/AutoAddScopeBuildItem.java#L291-L317","documentation":"AutoAddScopeBuildItem.Builder.build() requires that a matching predicate (set via match()) was configured. Without one, the build item would have no way to decide which classes to annotate, so it fails fast with IllegalStateException.","triggerScenarios":"Calling builder().defaultScope(...).build() (or similar) without ever invoking match(BiPredicate/DotName...) on the builder.","commonSituations":"Extension authors copying an AutoAddScopeBuildItem example and omitting the match() call; refactors that remove the predicate but leave build().","solutions":["Add a match() call to the builder before build()","Use AutoAddScopeBuildItem.builder().match(className).defaultScope(...).build() pattern","Consider annotating the class directly with the scope instead of using auto-add"],"exampleFix":"// before\nAutoAddScopeBuildItem.builder().defaultScope(ApplicationScoped.class).build();\n// after\nAutoAddScopeBuildItem.builder().match(c -> c.declaredAnnotations().contains(DOTNAME_PATH)).defaultScope(ApplicationScoped.class).build();","handlingStrategy":"validation","validationCode":"AutoAddScopeBuildItem.Builder b = AutoAddScopeBuildItem.builder().defaultScope(ApplicationScoped.class);\nObjects.requireNonNull(b, \"builder\");\n// ensure match() is called before build() — add an assertion in the build step\nassert hasMatchPredicate : \"match() must be set before build()\";","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair builder() with match() in the same statement chain","Use the fluent chain in a single expression so build() is last","Review builder usage with a unit test constructing each build item"],"tags":["quarkus","arc","builder","build-time"],"backgroundTag":"builder-misuse-missing-required-field","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}