{"record":{"id":"5af9a38caca35c97","repo":"quarkusio/quarkus","slug":"can-only-create-a-production-application-when-usin","errorCode":null,"errorMessage":"Can only create a production application when using NORMAL launch mode","messagePattern":"Can only create a production application when using NORMAL launch mode","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java","lineNumber":183,"sourceCode":"            BuildResult result = runAugment(true, Collections.emptySet(), null, classLoader, targets);\n\n            writeDebugSourceFile(result);\n            try {\n                BiConsumer<Object, BuildResult> consumer = (BiConsumer<Object, BuildResult>) Class\n                        .forName(resultHandler, false, classLoader)\n                        .getConstructor().newInstance();\n                consumer.accept(context, result);\n            } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | ClassNotFoundException\n                    | InvocationTargetException e) {\n                throw new RuntimeException(e);\n            }\n        }\n    }\n\n    @Override\n    public AugmentResult createProductionApplication() {\n        if (launchMode != LaunchMode.NORMAL) {\n            throw new IllegalStateException(\"Can only create a production application when using NORMAL launch mode\");\n        }\n        try (QuarkusClassLoader classLoader = curatedApplication.createDeploymentClassLoader()) {\n            BuildResult result = runAugment(true, Collections.emptySet(), null, classLoader, ArtifactResultBuildItem.class,\n                    DeploymentResultBuildItem.class, SbomBuildItem.class);\n\n            writeDebugSourceFile(result);\n\n            JarBuildItem jarBuildItem = result.consumeOptional(JarBuildItem.class);\n            NativeImageBuildItem nativeImageBuildItem = result.consumeOptional(NativeImageBuildItem.class);\n            List<ArtifactResultBuildItem> artifactResultBuildItems = result.consumeMulti(ArtifactResultBuildItem.class);\n            BuildSystemTargetBuildItem buildSystemTargetBuildItem = result.consume(BuildSystemTargetBuildItem.class);\n            Map<Path, List<SbomResult>> sboms = getSboms(result.consumeMulti(SbomBuildItem.class));\n\n            // this depends on the fact that the order in which we can obtain MultiBuildItems is the same as they are produced\n            // we want to write result of the final artifact created\n            if (artifactResultBuildItems.isEmpty()) {\n                throw new IllegalStateException(\"No artifact results were produced\");\n            }","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java#L165-L201","documentation":"createProductionApplication performs the production augmentation and requires the AugmentAction to have been created in LaunchMode.NORMAL. When the action was created for dev/test modes, it throws this IllegalStateException because the produced artifact semantics only make sense for a normal production build.","triggerScenarios":"Calling AugmentAction.createProductionApplication() on an AugmentAction obtained from a bootstrap in DEVELOPMENT, REMOTE_DEV, TEST or another non-NORMAL mode.","commonSituations":"Custom build tooling/test harnesses reusing a dev-mode AugmentAction to produce a jar; embedding code that builds the bootstrap with the app's current (dev) mode instead of forcing NORMAL; scripts that programmatically build the app while dev mode is active.","solutions":["Create a dedicated AugmentAction from a QuarkusBootstrap with Mode.NORMAL (PRODUCTION) before calling createProductionApplication().","Use the Maven/Gradle build (./mvnw package) for production artifacts instead of an in-process dev bootstrap.","Split the flow: dev-mode actions for development, a separate NORMAL-mode augmentation for packaging.","Assert the launch mode in your embedding code before invoking createProductionApplication."],"exampleFix":"// before\nQuarkusBootstrap.builder(app).setMode(QuarkusBootstrap.Mode.DEVELOPMENT)...createAugmentor().createProductionApplication();\n// after\nQuarkusBootstrap.builder(app).setMode(QuarkusBootstrap.Mode.PRODUCTION)...createAugmentor().createProductionApplication();","handlingStrategy":"try-catch","validationCode":"if (augmentAction.getLaunchMode() != LaunchMode.NORMAL) {\n    throw new IllegalStateException(\"createProductionApplication requires a NORMAL-mode AugmentAction\");\n}","typeGuard":null,"tryCatchPattern":"try { action.createProductionApplication(); } catch (IllegalStateException e) { if (e.getMessage().contains(\"NORMAL launch mode\")) { /* create a new NORMAL-mode AugmentAction and retry */ } else throw e; }","preventionTips":["Use the Maven/Gradle build for production artifacts","Keep dev-mode and packaging augmentations in separate flows","Assert launch mode before invoking production augmentation"],"tags":["augmentation","launch-mode","precondition"],"backgroundTag":"wrong-launch-mode","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"}