{"record":{"id":"3215bd6981de3b84","repo":"quarkusio/quarkus","slug":"unexpected-value-arcconfig-optimizecontexts","errorCode":null,"errorMessage":"Unexpected value: <arcConfig.optimizeContexts()>","messagePattern":"Unexpected value: <arcConfig\\.optimizeContexts\\(\\)>","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcProcessor.java","lineNumber":412,"sourceCode":"        for (SuppressConditionGeneratorBuildItem generator : suppressConditionGenerators) {\n            builder.addSuppressConditionGenerator(generator.getGenerator());\n        }\n\n        builder.setBuildCompatibleExtensions(buildCompatibleExtensions.entrypoint);\n        builder.setOptimizeContexts(new Predicate<BeanDeployment>() {\n            @Override\n            public boolean test(BeanDeployment deployment) {\n                switch (arcConfig.optimizeContexts()) {\n                    case TRUE:\n                        return true;\n                    case FALSE:\n                        return false;\n                    case AUTO:\n                        // Optimize the context if there is less than 1000 beans in the app\n                        // Note that removed beans are excluded\n                        return deployment.getBeans().size() < 1000;\n                    default:\n                        throw new IllegalArgumentException(\"Unexpected value: \" + arcConfig.optimizeContexts());\n                }\n            }\n        });\n\n        BeanProcessor beanProcessor = builder.build();\n        ContextRegistrar.RegistrationContext context = beanProcessor.registerCustomContexts();\n        return new ContextRegistrationPhaseBuildItem(context, beanProcessor);\n    }\n\n    // PHASE 2 - register all beans\n    @BuildStep\n    public BeanRegistrationPhaseBuildItem registerBeans(ContextRegistrationPhaseBuildItem contextRegistrationPhase,\n            List<ContextConfiguratorBuildItem> contextConfigurationRegistry,\n            BuildProducer<InterceptorResolverBuildItem> interceptorResolver,\n            BuildProducer<BeanDiscoveryFinishedBuildItem> beanDiscoveryFinished,\n            BuildProducer<TransformedAnnotationsBuildItem> transformedAnnotations,\n            BuildProducer<InvokerFactoryBuildItem> invokerFactory) {\n","sourceCodeStart":394,"sourceCodeEnd":430,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcProcessor.java#L394-L430","documentation":"The context-optimization switch in ArcProcessor switches over the OptimizeContexts enum (TRUE/FALSE/AUTO); the default branch throws IllegalArgumentException because a new/unmapped enum constant was added without updating the switch.","triggerScenarios":"Hitting the switch default branch for an OptimizeContexts value not explicitly handled — normally impossible with only TRUE/FALSE/AUTO, but occurs if a new enum constant is introduced or a custom/patched config value reaches the switch.","commonSituations":"Running a patched or version-mismatched Quarkus build where ArcConfig gained a new enum constant; bytecode/agent instrumentation altering enum values. Extremely rare for end users.","solutions":["Upgrade/align the Quarkus BOM so ArcConfig and ArcProcessor come from the same version","Report a bug to Quarkus if it reproduces on a stock build","Set quarkus.arc.optimize-contexts=true or false explicitly to avoid the AUTO branch path"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"OptimizeContexts v = arcConfig.optimizeContexts();\nif (v != OptimizeContexts.TRUE && v != OptimizeContexts.FALSE && v != OptimizeContexts.AUTO)\n    throw new IllegalArgumentException(\"Unsupported optimize-contexts: \" + v);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep Quarkus core modules version-aligned via the BOM","Handle all enum constants in new switches","Report missing default branches upstream"],"tags":["quarkus","arc","enum","build-time"],"backgroundTag":"unhandled-enum-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"}