{"record":{"id":"5326fec383e2ca56","repo":"quarkusio/quarkus","slug":"unable-to-construct-type-for-btremovedbean-e","errorCode":null,"errorMessage":"Unable to construct type for ${btRemovedBean}: ${e.getMessage()}","messagePattern":"Unable to construct type for (.+?): (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ComponentsProviderGenerator.java","lineNumber":462,"sourceCode":"                            for (BeanInfo btRemovedBean : group.removedBeans()) {\n                                // Bean types\n                                LocalVar rtTypes = b0.localVar(\"types\", b0.new_(HashSet.class));\n                                for (Type btType : btRemovedBean.getTypes()) {\n                                    if (DotNames.OBJECT.equals(btType.name())) {\n                                        // Skip java.lang.Object\n                                        continue;\n                                    }\n\n                                    b0.try_(tc -> {\n                                        tc.body(b1 -> {\n                                            try {\n                                                LocalVar rtType = RuntimeTypeCreator.of(b1)\n                                                        .withCache(typeCacheMap)\n                                                        .withTCCL(tccl)\n                                                        .create(btType);\n                                                b1.withSet(rtTypes).add(rtType);\n                                            } catch (IllegalArgumentException e) {\n                                                throw new IllegalStateException(\"Unable to construct type for \" + btRemovedBean\n                                                        + \": \" + e.getMessage());\n                                            }\n                                        });\n                                        tc.catch_(Throwable.class, \"e\", (b1, e) -> {\n                                            b1.invokeStatic(MethodDescs.COMPONENTS_PROVIDER_UNABLE_TO_LOAD_REMOVED_BEAN_TYPE,\n                                                    Const.of(btType.toString()), e);\n                                        });\n                                    });\n                                }\n\n                                // Qualifiers\n                                LocalVar rtQualifiers;\n                                if (btRemovedBean.hasDefaultQualifiers() || btRemovedBean.getQualifiers().isEmpty()) {\n                                    // No qualifiers or default qualifiers (@Any, @Default)\n                                    rtQualifiers = b0.localVar(\"qualifiers\", Const.ofNull(Set.class));\n                                } else {\n                                    rtQualifiers = b0.localVar(\"qualifiers\", b0.new_(HashSet.class));\n","sourceCodeStart":444,"sourceCodeEnd":480,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ComponentsProviderGenerator.java#L444-L480","documentation":"Arc's ComponentsProviderGenerator generates bytecode that enumerates beans removed since a previous build, including their runtime types. The RuntimeTypeCreator cannot convert the bean's Type into a runtime java.lang.reflect.Type (e.g. because parameterized types reference classes that cannot be loaded), so the generator wraps the IllegalArgumentException in this IllegalStateException. It is a build-time (deployment) failure, not a runtime one.","triggerScenarios":"A removed bean's declared type references a parameterized/wildcard type whose raw class is not loadable via the thread context classloader during incremental-build removed-bean reconstruction (generateAddRemovedBeans inside createComponentsProvider).","commonSituations":"Live-reload / incremental compilation after deleting or renaming a bean class that had generic types; hot-redeployment where an old JBuildIndex still references classes that no longer exist on the TCCL.","solutions":["Perform a clean rebuild (mvn clean or delete target/) so stale removed-bean metadata referencing unloadable types is discarded","Restore/rebuild the class that the removed bean's generic type references so it is loadable by the TCCL","Verify the bean's type does not use a type variable bound to a class missing from the application archive","If reproducible, report/inspect the btRemovedBean name in the message to find the offending stale bean"],"exampleFix":"// before: incremental reload fails with stale removed bean\n// after\nmvn clean quarkus:dev","handlingStrategy":"validation","validationCode":"// before build: ensure referenced generic types exist\nclass TypeCheck {\n  static void checkLoadable(String className) throws IllegalStateException {\n    try { Thread.currentThread().getContextClassLoader().loadClass(className); }\n    catch (ClassNotFoundException e) { throw new IllegalStateException(\"Type not loadable: \" + className, e); }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer clean builds over long-lived incremental dev mode sessions after deleting bean classes","Keep generic type arguments within the same module as the bean","Avoid referencing types from optional dependencies in bean signatures"],"tags":["quarkus","arc","cdi","build-time","type-resolution"],"backgroundTag":"cdi-bean-type-resolution-failed","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"}