{"record":{"id":"b028c5da0d11d0c3","repo":"quarkusio/quarkus","slug":"failed-to-transform-native-image-agent-configurati","errorCode":null,"errorMessage":"Failed to transform native image agent configuration","messagePattern":"Failed to transform native image agent configuration","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"devtools/maven/src/main/java/io/quarkus/maven/NativeImageAgentMojo.java","lineNumber":93,"sourceCode":"                    Files.copy(basePath.resolve(\"jni-config.json\"), targetPath.resolve(\"jni-config.json\"),\n                            StandardCopyOption.REPLACE_EXISTING);\n                    Files.copy(basePath.resolve(\"proxy-config.json\"), targetPath.resolve(\"proxy-config.json\"),\n                            StandardCopyOption.REPLACE_EXISTING);\n                    transformJsonObject(basePath, \"resource-config.json\", targetPath,\n                            JsonTransform.dropping(v -> discardResource(\"pattern\", v)));\n\n                    if (getLog().isInfoEnabled()) {\n                        getLog().info(\"Discovered native image agent generated files in \" + targetPath);\n                    }\n                } else {\n                    final Path reflectOriginsTxtPath = basePath.resolve(\"reflect-origins.txt\");\n                    if (reflectOriginsTxtPath.toFile().exists()) {\n                        getLog().info(\"Native image agent configuration origin files exist, inspect them manually inside \"\n                                + basePath);\n                    }\n                }\n            } catch (IOException e) {\n                throw new MojoExecutionException(\"Failed to transform native image agent configuration\", e);\n            }\n        } else {\n            getLog().debug(\"Missing \" + dirName + \" directory with native image agent configuration to transform\");\n        }\n    }\n\n    private void transformReachabilityMetadataJson(Path base, String name, Path target) throws IOException {\n        getLog().debug(\"Discarding resources from native image configuration that match the following regular expression: \"\n                + resourceSkipPattern);\n        final String original = Files.readString(base.resolve(name));\n        final JsonObject jsonRead = JsonReader.of(original).read();\n        JsonArray resources = jsonRead.get(\"resources\");\n        if (resources != null) {\n            final JsonObjectBuilder jsonBuilder = Json.object();\n            jsonBuilder.transform(jsonRead, JsonTransform.dropping(v -> discardResource(\"glob\", v)));\n\n            try (BufferedWriter writer = Files.newBufferedWriter(target.resolve(name))) {\n                jsonBuilder.appendTo(writer);","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/maven/src/main/java/io/quarkus/maven/NativeImageAgentMojo.java#L75-L111","documentation":"NativeImageAgentMojo transforms the raw output of the native image tracing agent (config JSON files) into Quarkus-consumable configuration. If reading/writing those files throws an IOException, this MojoExecutionException is thrown.","triggerScenarios":"Running `mvn quarkus:native-image-agent` (or related goal) when the agent output directory exists but files are unreadable, unwritable, malformed paths, or output locations cannot be created.","commonSituations":"Agent output directory from a prior run has wrong permissions; target/ cleaned between runs; agent never ran so referenced files are missing; path too long on Windows.","solutions":["Verify the agent output directory (default target/native-image-agent-base) contains the expected JSON config files","Fix read/write permissions on the directory and files","Re-run the native tests with the agent attached to regenerate fresh output","Check disk space and path validity","Read the wrapped IOException for the exact file that failed"],"exampleFix":"// before\nmvn quarkus:native-image-agent  # stale/partial agent output\n// after\nmvn clean && mvn -Pnative -Dquarkus.test.native-image-agent=... test && mvn quarkus:native-image-agent","handlingStrategy":"validation","validationCode":"Path dir = Path.of(\"target\", \"native-image-agent-base\");\nif (Files.isDirectory(dir)) {\n    try (var s = Files.list(dir)) {\n        if (s.findAny().isEmpty()) throw new IllegalStateException(\"agent output dir empty; run agent-enabled tests first\");\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run agent-enabled tests before the transform goal","mvn clean before re-recording agent output","Check permissions on target/native-image-agent-base","Verify sufficient disk space for agent dumps"],"tags":["maven","native-image","io","agent"],"backgroundTag":"file-io-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"}