{"record":{"id":"e7fbc28f2157d4a4","repo":"quarkusio/quarkus","slug":"failed-to-load-the-condition-class-testclassname","errorCode":null,"errorMessage":"Failed to load the condition class ${testClassName} for capability ${name}","messagePattern":"Failed to load the condition class (.+?) for capability (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/steps/CapabilityAggregationStep.java","lineNumber":71,"sourceCode":"            final String provider = contract.getExtension();\n            for (String capability : contract.getProvidesCapabilities()) {\n                int conditionIndex = capability.indexOf('?');\n                final String name = conditionIndex < 0 ? capability : capability.substring(0, conditionIndex);\n                int testClassStart;\n                boolean provide = true;\n                while (conditionIndex > 0 && provide) {\n                    final boolean inv = conditionIndex < capability.length() - 1\n                            && capability.charAt(conditionIndex + 1) == '!';\n                    testClassStart = conditionIndex + (inv ? 2 : 1);\n                    conditionIndex = capability.indexOf('?', testClassStart + 1);\n                    final String testClassName = capability\n                            .substring(testClassStart, conditionIndex > 0 ? conditionIndex : capability.length());\n                    Class<? extends BooleanSupplier> testClass;\n                    try {\n                        testClass = Thread.currentThread().getContextClassLoader().loadClass(testClassName)\n                                .asSubclass(BooleanSupplier.class);\n                    } catch (ClassNotFoundException e) {\n                        throw new RuntimeException(\n                                \"Failed to load the condition class \" + testClassName + \" for capability \" + name, e);\n                    }\n\n                    provide = supplierFactory.get(testClass).getAsBoolean();\n                }\n                if (provide) {\n                    producer.produce(new CapabilityBuildItem(name, provider));\n                    capabilityNames.add(name);\n                }\n            }\n        }\n        configuredCapsProducer.produce(new CapabilitiesConfiguredInDescriptorsBuildItem(capabilityNames));\n    }\n\n    /**\n     * Aggregates all the capability build items. Not all the capabilities are configured in the extension descriptors.\n     * Many are still produced by build steps directly.\n     *","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/steps/CapabilityAggregationStep.java#L53-L89","documentation":"Capabilities can declare conditional activation via an inline BooleanSupplier class name embedded in the capability string. CapabilityAggregationStep.provideCapabilities loads that class from the thread-context classloader; if the condition class is not on the augmentation classpath, it throws RuntimeException naming the class and capability.","triggerScenarios":"A capability string contains a '<test-class>:<condition>' style suffix (e.g. io.quarkus.capability conditional syntax) referencing a BooleanSupplier class that is not present at augmentation time; the extension providing the condition class is missing or renamed.","commonSituations":"Removing/downgrading an extension that provided the condition class while another extension still declares the conditional capability; typos or renamed condition classes in capability declarations; classloader/context issues in custom build tooling.","solutions":["Add the extension/module that provides the referenced condition class back to the application dependencies","Check the capability string in the failing extension's BuildStep and verify the test class name and package are correct","Align all Quarkus extension versions (quarkus-bom) so capability conditions and providers match","Search the codebase for the capability name to find which extension declares the condition and why it is absent"],"exampleFix":"// before (pom.xml)\n<!-- io.quarkus:quarkus-jdbc-postgresql removed, condition class missing -->\n// after\n<dependency>\n  <groupId>io.quarkus</groupId>\n  <artifactId>quarkus-jdbc-postgresql</artifactId>\n</dependency>","handlingStrategy":"validation","validationCode":"static void checkCapabilityCondition(String capability) throws ClassNotFoundException {\n    int lt = capability.indexOf('<');\n    if (lt > 0) {\n        String cls = capability.substring(lt + 1, capability.length() - 1);\n        Thread.currentThread().getContextClassLoader().loadClass(cls);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    // augmentation\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Failed to load the condition class\")) {\n        throw new IllegalStateException(\"Add the extension providing the capability condition class\", e);\n    }\n    throw e;\n}","preventionTips":["Keep the extension that provides a capability's condition class on the classpath","Import the Quarkus BOM so capability declarations and providers stay version-aligned","Grep capability strings for '<' conditional syntax and verify each referenced BooleanSupplier exists"],"tags":["build-time","capabilities","classpath","classloading"],"backgroundTag":"condition-class-not-found","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"}