{"record":{"id":"2cfa034aef61b9c1","repo":"quarkusio/quarkus","slug":"stereotype-must-not-declare-named-with-a-non-empt","errorCode":null,"errorMessage":"Stereotype must not declare @Named with a non-empty value: ${stereotypeClass}","messagePattern":"Stereotype must not declare @Named with a non-empty value: (.+?)","errorType":"exception","errorClass":"DefinitionException","httpStatus":null,"severity":"error","filePath":"independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java","lineNumber":1024,"sourceCode":"                boolean isAlternative = false;\n                Integer alternativePriority = null;\n                Set<ScopeInfo> scopes = new HashSet<>();\n                List<AnnotationInstance> bindings = new ArrayList<>();\n                List<AnnotationInstance> parentStereotypes = new ArrayList<>();\n                boolean isNamed = false;\n\n                for (AnnotationInstance annotation : annotationStore.getAnnotations(stereotypeClass)) {\n                    if (DotNames.ALTERNATIVE.equals(annotation.name())) {\n                        isAlternative = true;\n                    } else if (interceptorBindings.containsKey(annotation.name())) {\n                        bindings.add(annotation);\n                    } else if (stereotypeNames.contains(annotation.name())) {\n                        parentStereotypes.add(annotation);\n                    } else if (DotNames.NAMED.equals(annotation.name())) {\n                        if (annotation.value() != null && !annotation.value()\n                                .asString()\n                                .isEmpty()) {\n                            throw new DefinitionException(\n                                    \"Stereotype must not declare @Named with a non-empty value: \" + stereotypeClass);\n                        }\n                        isNamed = true;\n                    } else if (DotNames.PRIORITY.equals(annotation.name())) {\n                        alternativePriority = annotation.value().asInt();\n                    } else {\n                        final ScopeInfo scope = getScope(annotation.name(), customContextScopes);\n                        if (scope != null) {\n                            scopes.add(scope);\n                        }\n                    }\n                }\n                boolean isAdditionalStereotype = additionalStereotypes.contains(stereotypeName);\n                final ScopeInfo scope = getValidScope(scopes, stereotypeClass);\n                boolean isInherited = stereotypeClass.declaredAnnotation(DotNames.INHERITED) != null;\n                stereotypes.put(stereotypeName, new StereotypeInfo(scope, bindings, isAlternative, alternativePriority,\n                        isNamed, isAdditionalStereotype, stereotypeClass, isInherited, parentStereotypes));\n            }","sourceCodeStart":1006,"sourceCodeEnd":1042,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java#L1006-L1042","documentation":"Per CDI, a stereotype must not declare @Named with a non-empty value (a stereotype can only mark the bean named, not fix its name). During BeanDeployment stereotype metadata processing, Arc throws DefinitionException if a @Named annotation on a stereotype class carries a value.","triggerScenarios":"Declaring a stereotype like @Stereotype @Named(\"foo\") public @interface MyStereotype {} — the value \"foo\" is illegal; an empty @Named(\"\") or plain @Named is allowed.","commonSituations":"Copy-pasting @Named(\"x\") onto a stereotype; combining controller/action-style naming patterns from other frameworks into stereotypes; upgrading from another CDI implementation that didn't enforce this.","solutions":["Remove the value: use plain @Named inside the stereotype","Move the specific name onto the bean class instead of the stereotype","Remove @Named from the stereotype if naming isn't needed"],"exampleFix":"// before\n@Stereotype @Named(\"myBean\") @interface MyStereotype {}\n// after\n@Stereotype @Named @interface MyStereotype {}","handlingStrategy":"validation","validationCode":"Named named = stereotypeClass.getAnnotation(Named.class);\nif (named != null && !named.value().isEmpty()) throw new DefinitionException(\"Stereotype @Named must be empty\");","typeGuard":null,"tryCatchPattern":"try { deployment.init(); }\ncatch (DefinitionException e) { if (e.getMessage().contains(\"@Named\")) log.error(\"Fix stereotype: use plain @Named\"); throw e; }","preventionTips":["Inside stereotypes use @Named without a value","Put concrete bean names on the bean class, not the stereotype","Grep stereotypes for @Named(\"...\") during code review"],"tags":["cdi","stereotype","named","definition-error","arc"],"backgroundTag":"stereotype-named-nonempty-value","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"}