{"record":{"id":"7825d258f7343119","repo":"quarkusio/quarkus","slug":"failed-to-generate-sources-in-the-quarkusgeneratec","errorCode":null,"errorMessage":"Failed to generate sources in the QuarkusGenerateCode task for ","messagePattern":"Failed to generate sources in the QuarkusGenerateCode task for ","errorType":"exception","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/worker/CodeGenWorker.java","lineNumber":89,"sourceCode":"                            params.getSourceDirectories().getFiles().stream().map(File::toPath).collect(Collectors.toList())),\n                    // Path generatedSourcesDir,\n                    generatedSourceDir,\n                    // Path buildDir,\n                    buildDir,\n                    // Consumer<Path> sourceRegistrar,\n                    sourceRegistrar,\n                    // ApplicationModel appModel,\n                    appCreationContext.getApplicationModel(),\n                    // Properties properties,\n                    props,\n                    // String launchMode,\n                    launchMode.name(),\n                    // boolean test\n                    launchMode == LaunchMode.TEST);\n        } catch (BootstrapException | IllegalAccessException | InvocationTargetException | ClassNotFoundException e) {\n            // Gradle \"abbreviates\" the stacktrace to something human-readable, but here the underlying cause might\n            // get lost in the error output, so add 'e' to the message.\n            throw new GradleException(\"Failed to generate sources in the QuarkusGenerateCode task for \" + gav + \" due to \" + e,\n                    e);\n        }\n    }\n}\n","sourceCodeStart":71,"sourceCodeEnd":94,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/worker/CodeGenWorker.java#L71-L94","documentation":"CodeGenWorker.execute invokes the reflectively obtained code generator and catches BootstrapException, IllegalAccessException, InvocationTargetException, and ClassNotFoundException, rethrowing as GradleException with the GAV and exception embedded in the message (since Gradle abbreviates stack traces). It means the code generation phase itself failed at runtime for this project.","triggerScenarios":"Running quarkusGenerateCode where the generator bootstrap fails (BootstrapException), the reflective initAndRun invocation throws inside the generator (InvocationTargetException), the CodeGenerator class can't be loaded (ClassNotFoundException), or access is denied (IllegalAccessException).","commonSituations":"Broken/generator extension jars on the classpath after partial upgrades; invalid generator input (bad OpenAPI/Avro/protobuf sources); Java module/access issues; missing generator class because the providing extension wasn't applied; stale classloader state in the Gradle daemon.","solutions":["Read the 'due to ...' cause — for InvocationTargetException inspect its cause for the real generator error.","Fix the offending input file flagged by the generator (e.g. malformed schema/OpenAPI spec).","Clean build outputs and re-run: ./gradlew clean quarkusGenerateCode.","Align Quarkus core and generator extension versions.","Restart the Gradle daemon to clear stale classloaders."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"./gradlew clean quarkusGenerateCode --info  # clean run reveals the failing generator/input\ngit diff --stat build/generated-sources 2>/dev/null # spot stale outputs","typeGuard":null,"tryCatchPattern":"try {\n    ./gradlew quarkusGenerateCode\n} catch (GradleException e) {\n    if (e.getMessage().startsWith(\"Failed to generate sources in the QuarkusGenerateCode task\")) {\n        Throwable root = e;\n        while (root.getCause() != null) root = root.getCause(); // InvocationTargetException hides the real error\n        System.err.println(root);\n    }\n}","preventionTips":["Validate generator inputs (OpenAPI specs, Avro/protobuf schemas) before building","Keep generator-providing extensions and quarkus-core version-aligned","Clean generated sources after upgrades","Unwrap the full cause chain — InvocationTargetException masks the generator's real error"],"tags":["gradle","codegen","bootstrap","reflection"],"backgroundTag":"quarkus-bootstrap-failed","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"}