{"record":{"id":"443f5bcdd09aaf0e","repo":"quarkusio/quarkus","slug":"quarkus-code-generation-phase-has-failed-443f5b","errorCode":null,"errorMessage":"Quarkus code generation phase has failed","messagePattern":"Quarkus code generation phase has failed","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"devtools/maven/src/main/java/io/quarkus/maven/GenerateCodeMojo.java","lineNumber":104,"sourceCode":"        CuratedApplication curatedApplication = null;\n        QuarkusClassLoader deploymentClassLoader = null;\n        try {\n            curatedApplication = bootstrapApplication(launchMode);\n            deploymentClassLoader = curatedApplication.createDeploymentClassLoader();\n            Thread.currentThread().setContextClassLoader(deploymentClassLoader);\n\n            final Class<?> codeGenerator = deploymentClassLoader.loadClass(\"io.quarkus.deployment.CodeGenerator\");\n            final Method initAndRun = codeGenerator.getMethod(\"initAndRun\", QuarkusClassLoader.class, PathCollection.class,\n                    Path.class, Path.class,\n                    Consumer.class, ApplicationModel.class, Properties.class, String.class,\n                    boolean.class);\n            initAndRun.invoke(null, deploymentClassLoader, sourceParents,\n                    generatedSourcesDir(test), buildDir().toPath(),\n                    sourceRegistrar, curatedApplication.getApplicationModel(), getBuildSystemProperties(false),\n                    launchMode.name(),\n                    test);\n        } catch (Exception any) {\n            throw new MojoExecutionException(\"Quarkus code generation phase has failed\", any);\n        } finally {\n            Thread.currentThread().setContextClassLoader(originalTccl);\n            if (deploymentClassLoader != null) {\n                deploymentClassLoader.close();\n            }\n            // In case of the test mode, we can't share the application model with the test plugins, so we are closing it right away,\n            // but we are serializing the application model so the test plugins can deserialize it from disk instead of re-initializing\n            // the resolver and re-resolving it as part of the test bootstrap\n            if (test && curatedApplication != null) {\n                var appModel = curatedApplication.getApplicationModel();\n\n                injectTestJvmArgsFromDependencies(appModel.getRuntimeDependencies());\n\n                closeApplication(LaunchMode.TEST);\n                if (isSerializeTestModel()) {\n                    final int workspaceId = getWorkspaceId();\n                    if (workspaceId != 0) {\n                        try {","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/maven/src/main/java/io/quarkus/maven/GenerateCodeMojo.java#L86-L122","documentation":"GenerateCodeMojo (the quarkus:generate-code goal) bootstraps a curated application, creates a deployment classloader and reflectively invokes Quarkus initAndRun for code generation. Any exception thrown during that invocation is wrapped in this MojoExecutionException with the original cause attached. The real failure reason is always in the `Caused by` chain.","triggerScenarios":"Any Exception (checked or runtime) escaping initAndRun.invoke(...) during `mvn quarkus:generate-code` (also run as part of quarkus:dev and package builds) — e.g. bootstrap/curate failures, config errors, build-step exceptions.","commonSituations":"Invalid application configuration (unresolvable quarkus.* properties); compilation-dependent generation failures; incompatible extension versions vs. platform BOM; missing classes on the deployment classloader; port/resource conflicts during augmentation.","solutions":["Read the `Caused by` chain of this exception for the root cause and fix that","Run `./mvnw clean` then regenerate to clear stale generated sources","Align all io.quarkus dependencies to one platform version via the Quarkus BOM","Reproduce with `mvn quarkus:generate-code -e` for full stack traces"],"exampleFix":"// diagnostic command\nmvn quarkus:generate-code -e -X  # inspect full Caused-by chain","handlingStrategy":"try-catch","validationCode":"mvn quarkus:generate-code -e  # run the goal first and read the Caused-by chain before packaging","typeGuard":null,"tryCatchPattern":"try {\n    mvn quarkus:generate-code\n} catch (MojoExecutionException e) {\n    Throwable root = e; while (root.getCause() != null) root = root.getCause();\n    // diagnose root.getMessage()\n}","preventionTips":["Keep all io.quarkus dependencies on one platform version","Run clean builds after upgrading Quarkus","Validate quarkus.* configuration before augmentation"],"tags":["maven","code-generation","build","quarkus"],"backgroundTag":"build-phase-failed","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"}