{"record":{"id":"1ffaa68c71f235fe","repo":"quarkusio/quarkus","slug":"name-must-be-set","errorCode":null,"errorMessage":"${name} must be set","messagePattern":"(.+?) must be set","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/BeanManagerImpl.java","lineNumber":384,"sourceCode":"        ArcContainerImpl.instance().registeredQualifiers.verify(specifiedQualifiers);\n        ArcContainerImpl.instance().registeredQualifiers.verify(observedEventQualifiers);\n\n        Set<Annotation> eventQualifiers = new HashSet<>(specifiedQualifiers);\n        if (eventQualifiers.isEmpty()) {\n            eventQualifiers.add(Default.Literal.INSTANCE);\n        }\n        eventQualifiers.add(Any.Literal.INSTANCE);\n\n        Set<Type> eventTypes = new HierarchyDiscovery(specifiedType).getTypeClosure();\n        if (!EventTypeAssignabilityRules.instance().matches(observedEventType, eventTypes)) {\n            return false;\n        }\n        return ArcContainerImpl.instance().registeredQualifiers.isSubset(observedEventQualifiers, eventQualifiers);\n    }\n\n    private static void illegalNull(Object obj, String name) {\n        if (obj == null) {\n            throw new IllegalArgumentException(name + \" must be set\");\n        }\n    }\n}\n","sourceCodeStart":366,"sourceCodeEnd":388,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/BeanManagerImpl.java#L366-L388","documentation":"ArC (Quarkus's CDI implementation) throws this IllegalArgumentException from its null-check helper `illegalNull` in BeanManagerImpl whenever a CDI API method (e.g. those used by isMatchingBean/isMatchingEvent) is called with a null for a mandatory parameter such as a bean type, qualifier, or event object. The CDI specification requires these arguments to be non-null, so ArC fails fast rather than producing undefined behavior downstream.","triggerScenarios":"Calling BeanManager methods like getBeans(), getBeans(Type, Annotation...), resolve(), fireEvent(), or event-related matching helpers while passing null for the required Type, Annotation, or Event object argument.","commonSituations":"Refactored code where a bean class or qualifier variable became null; injecting qualifiers dynamically from config that is absent; framework glue code that forwards nullable user input straight into BeanManager lookups.","solutions":["Find the call site passing null into the BeanManager method and ensure the type/qualifier argument is non-null before the call.","If the value comes from configuration or optional injection, initialize it with a sensible default or reject it early at startup.","If you only need optional lookup, guard with a null check and skip the BeanManager call instead of calling it with null."],"exampleFix":"// before\nBean<?> bean = beanManager.resolve(beanManager.getBeans(myType, myQualifier)); // myType may be null\n\n// after\nObjects.requireNonNull(myType, \"bean type must be set\");\nBean<?> bean = beanManager.resolve(beanManager.getBeans(myType, myQualifier));","handlingStrategy":"validation","validationCode":"if (beanType == null || qualifiers == null) {\n    throw new IllegalStateException(\"beanType and qualifiers must be non-null before BeanManager lookup\");\n}","typeGuard":"static boolean isUsableLookupArg(Object o) { return o != null; }","tryCatchPattern":"try {\n    beanManager.getBeans(type, qualifiers);\n} catch (IllegalArgumentException e) {\n    if (!e.getMessage().contains(\"must be set\")) throw e;\n    // handle null-argument case\n}","preventionTips":["Apply Objects.requireNonNull to type/qualifier inputs at API boundaries before touching BeanManager.","Never forward optional/config-derived values unguarded into CDI lookup calls.","Write unit tests for lookup helpers using null inputs."],"tags":["cdi","null-argument","quarkus-arc","bean-manager"],"backgroundTag":"null-required-argument","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"}