{"record":{"id":"91b3b6bd37de17c6","repo":"quarkusio/quarkus","slug":"more-than-one-applyserviceaccountnamedecorator-fou","errorCode":null,"errorMessage":"More than one ApplyServiceAccountNameDecorator found","messagePattern":"More than one ApplyServiceAccountNameDecorator found","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/BaseKubeProcessor.java","lineNumber":906,"sourceCode":"                            .build()));\n                });\n    }\n\n    private static final String DEFAULT_RESTART_POLICY = JobRestartPolicy.OnFailure.name();\n    private static final String DEFAULT_COMPLETION_MODE = JobCompletionMode.NonIndexed.name();\n\n    private void createInitJobDecorators(DecoratorsContext context, List<KubernetesJobBuildItem> items) {\n        List<AddEnvVarDecorator> envVarDecorators = context.decoratorsOfType(AddEnvVarDecorator.class);\n\n        List<AddMountDecorator> mountDecorators = context.decoratorsOfType(AddMountDecorator.class);\n\n        final Optional<ApplyServiceAccountNameDecorator> serviceAccount;\n        List<ApplyServiceAccountNameDecorator> serviceAccountDecorators = context\n                .decoratorsOfType(ApplyServiceAccountNameDecorator.class);\n        final var size = serviceAccountDecorators.size();\n        if (size > 0) {\n            if (size > 1) {\n                throw new IllegalStateException(\"More than one ApplyServiceAccountNameDecorator found\");\n            }\n            serviceAccount = Optional.of(serviceAccountDecorators.get(0));\n        } else {\n            serviceAccount = Optional.empty();\n        }\n\n        Targetable.filteredByTarget(items, context.target).forEach(item -> {\n\n            final var name = item.getName();\n            final var serviceAccountName = serviceAccount.map(sa -> sa.getServiceAccountNameOrDefault(name)).orElse(name);\n            // specialized Job resource creator, overriding defaults and adding extra configuration\n            // this is needed as we've removed decorators that were previously applied to the simple job resource created here\n            // with this specialized job creator, we inherit the behavior that directly sets values instead of using decorators but add specialized behavior as well\n            final var job = new AddJobResourceDecorator(name, config(), null) {\n                @Override\n                protected void initBuilderWithDefaults(JobBuilder builder) {\n                    super.initBuilderWithDefaults(builder);\n","sourceCodeStart":888,"sourceCodeEnd":924,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/BaseKubeProcessor.java#L888-L924","documentation":"BaseKubeProcessor's constructor inspects the resource context for existing ApplyServiceAccountNameDecorator instances added by other processors/extensions. Because at most one service account name decorator may exist (a second would conflict/overwrite), finding more than one throws IllegalStateException. This is a build-pipeline invariant violation rather than a user config error per se.","triggerScenarios":"More than one processor added an ApplyServiceAccountNameDecorator to the deployment context before BaseKubeProcessor runs — e.g. two deployment-target variants (kubernetes + openshift) both generating SA decorators into the same context, or a custom extension contributing a duplicate decorator.","commonSituations":"Building multiple deployment targets simultaneously where each variant's processor adds its own SA decorator; custom extensions adding ApplyServiceAccountNameDecorator on top of the vanilla processor; upgrades where processor ordering/exclusivity changed.","solutions":["Check for custom code or extensions adding ApplyServiceAccountNameDecorator and remove the duplicate","Build one deployment target per invocation (quarkus.kubernetes.deployment-target=kubernetes only) to isolate variants","Upgrade/downgrade Quarkus if this occurs with stock extensions only (processor conflict regression)","File/debug in the contributing extension: only one SA decorator must be added per context"],"exampleFix":"// before (custom processor adds another)\ncontext.add(new ApplyServiceAccountNameDecorator(name, saName));\n// after: reuse/replace instead of adding\ncustomizer.customizeExistingDecorator(ApplyServiceAccountNameDecorator.class, d -> d.setName(saName));","handlingStrategy":"validation","validationCode":"long count = context.decoratorsOfType(ApplyServiceAccountNameDecorator.class).size();\nif (count > 1) fail(\"duplicate ApplyServiceAccountNameDecorator detected\");","typeGuard":null,"tryCatchPattern":"try { new BaseKubeProcessor(serviceAccount); } catch (IllegalStateException e) { /* another extension added a duplicate SA decorator */ }","preventionTips":["Never add ApplyServiceAccountNameDecorator from custom processors; reuse the existing one","Build one deployment target per invocation","Keep extensions updated to avoid processor ordering conflicts"],"tags":["kubernetes","decorator","service-account","build"],"backgroundTag":"duplicate-decorator","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"}