quarkusio/quarkus · error · IllegalStateException
Can only create a production application when using NORMAL l
Error message
Can only create a production application when using NORMAL launch mode
What it means
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.
Source
Thrown at core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java:183
BuildResult result = runAugment(true, Collections.emptySet(), null, classLoader, targets);
writeDebugSourceFile(result);
try {
BiConsumer<Object, BuildResult> consumer = (BiConsumer<Object, BuildResult>) Class
.forName(resultHandler, false, classLoader)
.getConstructor().newInstance();
consumer.accept(context, result);
} catch (InstantiationException | IllegalAccessException | NoSuchMethodException | ClassNotFoundException
| InvocationTargetException e) {
throw new RuntimeException(e);
}
}
}
@Override
public AugmentResult createProductionApplication() {
if (launchMode != LaunchMode.NORMAL) {
throw new IllegalStateException("Can only create a production application when using NORMAL launch mode");
}
try (QuarkusClassLoader classLoader = curatedApplication.createDeploymentClassLoader()) {
BuildResult result = runAugment(true, Collections.emptySet(), null, classLoader, ArtifactResultBuildItem.class,
DeploymentResultBuildItem.class, SbomBuildItem.class);
writeDebugSourceFile(result);
JarBuildItem jarBuildItem = result.consumeOptional(JarBuildItem.class);
NativeImageBuildItem nativeImageBuildItem = result.consumeOptional(NativeImageBuildItem.class);
List<ArtifactResultBuildItem> artifactResultBuildItems = result.consumeMulti(ArtifactResultBuildItem.class);
BuildSystemTargetBuildItem buildSystemTargetBuildItem = result.consume(BuildSystemTargetBuildItem.class);
Map<Path, List<SbomResult>> sboms = getSboms(result.consumeMulti(SbomBuildItem.class));
// this depends on the fact that the order in which we can obtain MultiBuildItems is the same as they are produced
// we want to write result of the final artifact created
if (artifactResultBuildItems.isEmpty()) {
throw new IllegalStateException("No artifact results were produced");
}View on GitHub (pinned to e1c734241f)
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.
Example fix
// before QuarkusBootstrap.builder(app).setMode(QuarkusBootstrap.Mode.DEVELOPMENT)...createAugmentor().createProductionApplication(); // after QuarkusBootstrap.builder(app).setMode(QuarkusBootstrap.Mode.PRODUCTION)...createAugmentor().createProductionApplication();
Defensive patterns
Strategy: try-catch
Validate before calling
if (augmentAction.getLaunchMode() != LaunchMode.NORMAL) {
throw new IllegalStateException("createProductionApplication requires a NORMAL-mode AugmentAction");
} Try / catch
try { action.createProductionApplication(); } catch (IllegalStateException e) { if (e.getMessage().contains("NORMAL launch mode")) { /* create a new NORMAL-mode AugmentAction and retry */ } else throw e; } Prevention
- Use the Maven/Gradle build for production artifacts
- Keep dev-mode and packaging augmentations in separate flows
- Assert launch mode before invoking production augmentation
When it happens
Trigger: Calling AugmentAction.createProductionApplication() on an AugmentAction obtained from a bootstrap in DEVELOPMENT, REMOTE_DEV, TEST or another non-NORMAL mode.
Common situations: 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.
Related errors
- Unknown launch mode
- Failed to prepare injector constructor ${injectCtor} of byte
- Failed to injector constructor ${injectCtor} of bytecode rec
- No artifact results were produced
- Unable to locate effective artifact
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/5af9a38caca35c97.
Report an issue: GitHub.