{"record":{"id":"6b38a25ff4cf6542","repo":"quarkusio/quarkus","slug":"only-a-single-bouncy-castle-registration-can-be-pr","errorCode":null,"errorMessage":"Only a single Bouncy Castle registration can be provided.","messagePattern":"Only a single Bouncy Castle registration can be provided\\.","errorType":"exception","errorClass":"java.lang.IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/security/deployment/src/main/java/io/quarkus/security/deployment/SecurityProcessor.java","lineNumber":627,"sourceCode":"        boolean isInFipsMode;\n\n        Optional<BouncyCastleJsseProviderBuildItem> bouncyCastleJsseProvider = getOne(bouncyCastleJsseProviders);\n        if (bouncyCastleJsseProvider.isPresent()) {\n            isInFipsMode = bouncyCastleJsseProvider.get().isInFipsMode();\n        } else {\n            Optional<BouncyCastleProviderBuildItem> bouncyCastleProvider = getOne(bouncyCastleProviders);\n            isInFipsMode = bouncyCastleProvider.isPresent() && bouncyCastleProvider.get().isInFipsMode();\n        }\n\n        if (isInFipsMode) {\n            jpmsExports.produce(new JPMSExportBuildItem(\"java.base\", \"sun.security.internal.spec\"));\n            jpmsExports.produce(new JPMSExportBuildItem(\"java.base\", \"sun.security.provider\"));\n        }\n    }\n\n    private static <BI extends MultiBuildItem> Optional<BI> getOne(List<BI> items) {\n        if (items.size() > 1) {\n            throw new IllegalStateException(\"Only a single Bouncy Castle registration can be provided.\");\n        }\n        return items.stream().findFirst();\n    }\n\n    /**\n     * Determine the classes that make up the provider and its services\n     *\n     * @param providerName - JCA provider name\n     * @return class names that make up the provider and its services\n     */\n    private static List<String> registerProvider(String providerName,\n            List<String> providerConfigs,\n            BuildProducer<NativeImageSecurityProviderBuildItem> additionalProviders) {\n        List<String> providerClasses = new ArrayList<>();\n        Provider provider = Security.getProvider(providerName);\n        if (provider != null) {\n            providerClasses.add(provider.getClass().getName());\n            for (Provider.Service service : provider.getServices()) {","sourceCodeStart":609,"sourceCodeEnd":645,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/security/deployment/src/main/java/io/quarkus/security/deployment/SecurityProcessor.java#L609-L645","documentation":"Quarkus supports registering the Bouncy Castle security provider either via quarkus.security.security-providers=bc / bcjsse or via explicit dependencies/extensions, but only one registration path per provider kind. SecurityProcessor.getOne() enforces that at most one build item of a given Bouncy Castle registration type exists; more than one means conflicting registrations were detected during the build.","triggerScenarios":"Both the quarkus-security extension's automatic BC registration (config property) and an explicit Bouncy Castle registration (e.g. custom extension or another provider-affecting config) are present at the same time; or the bc and bcjsse configurations overlap producing two build items of the same type.","commonSituations":"Setting quarkus.security.security-providers=bc while also adding a Bouncy Castle JSSE configuration; migrating config and leaving duplicate entries in application.properties and profile-specific files (test/prod profiles).","solutions":["Remove the duplicate registration: keep either quarkus.security.security-providers=bc (or bcjsse) or the explicit dependency-based registration, not both.","Check all application.properties/application-*.properties files for duplicated security-providers entries.","Inspect which extensions/dependencies bring in a BC registration and drop the redundant one."],"exampleFix":"# before\nquarkus.security.security-providers=bc\nquarkus.security.security-providers=bcjsse\n\n# after\nquarkus.security.security-providers=bcjsse","handlingStrategy":"validation","validationCode":"# ensure only one BC registration exists\n# grep all config files:\ngrep -rn \"security-providers\" src/main/resources src/test/resources","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Register BC exactly once, via config or dependency — never both","Check profile-specific property files for duplicates","Document the single registration path in team setup guides"],"tags":["quarkus","security","bouncycastle","configuration"],"backgroundTag":"duplicate-provider-registration","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"}