{"record":{"id":"133e7c9e16b46742","repo":"quarkusio/quarkus","slug":"unable-to-write-quarkus-native-image-agent-caller","errorCode":null,"errorMessage":"Unable to write quarkus native image agent caller filter to <path>","messagePattern":"Unable to write quarkus native image agent caller filter to <path>","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"devtools/maven/src/main/java/io/quarkus/maven/GenerateCodeTestsMojo.java","lineNumber":104,"sourceCode":"    }\n\n    private void generateNativeAgentFilter(Collection<String> packageNames, Path path) throws MojoExecutionException {\n        final Json.JsonObjectBuilder result = Json.object();\n\n        final Json.JsonArrayBuilder rules = Json.array();\n        packageNames.stream()\n                .map(packageName -> Json.object().put(\"excludeClasses\", packageName + \".**\"))\n                .forEach(rules::add);\n        result.put(\"rules\", rules);\n\n        final Json.JsonArrayBuilder regexRules = Json.array();\n        regexRules.add(Json.object().put(\"excludeClasses\", \".*_Bean\"));\n        result.put(\"regexRules\", regexRules);\n\n        try (BufferedWriter writer = new BufferedWriter(new FileWriter(path.toFile(), StandardCharsets.UTF_8))) {\n            result.appendTo(writer);\n        } catch (IOException e) {\n            throw new MojoExecutionException(\"Unable to write quarkus native image agent caller filter to \" + path, e);\n        }\n    }\n\n    private Collection<ResolvedDependency> getDependencies() throws MojoExecutionException {\n        try (CuratedApplication curatedApplication = bootstrapApplication(LaunchMode.TEST)) {\n            return curatedApplication.getApplicationModel().getDependencies();\n        } catch (Exception any) {\n            throw new MojoExecutionException(\"Quarkus native image agent filter generation phase has failed\", any);\n        }\n    }\n\n    private Set<String> getCommonExcludePackageNames() {\n        Set<String> packageNames = new HashSet<>();\n        // Any calls that access or originate in these packages\n        // that require native configuration should be handled by Quarkus.\n        packageNames.add(\"io.netty\");\n        packageNames.add(\"io.quarkus\");\n        packageNames.add(\"io.smallrye\");","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/maven/src/main/java/io/quarkus/maven/GenerateCodeTestsMojo.java#L86-L122","documentation":"GenerateCodeTestsMojo.generateNativeAgentFilter writes a JSON caller-filter file used by the Quarkus native image agent. If BufferedWriter/appendTo throws IOException it wraps it in this MojoExecutionException naming the target path. The failure is purely about persisting the generated filter file to disk.","triggerScenarios":"Opening or writing path.toFile() with FileWriter(UTF-8) fails — e.g. the target directory does not exist, the path is a directory, or the process lacks write permission.","commonSituations":"target/ directory removed or read-only during CI; running `mvn quarkus:generate-code-tests` with -Dquarkus.test.native-image-agent-filter-files pointing to an unwritable/nonexistent location; disk-full conditions.","solutions":["Ensure the parent directory of the filter file exists and is writable (e.g. `mvn quarkus:generate-code-tests` after a build creates target/)","Check file permissions on the output path and that it is not a directory","Free disk space / verify the path configured for the agent filter files is valid"],"exampleFix":"// before\nmkdir target  # only if missing, before running\nmvn quarkus:generate-code-tests\n// after\nmvn process-test-classes quarkus:generate-code-tests  # ensures target/ exists","handlingStrategy":"validation","validationCode":"test -w <filter-file-dir> && test ! -d <filter-file> && df -h <filter-file-dir>","typeGuard":null,"tryCatchPattern":"try {\n    mvn quarkus:generate-code-tests\n} catch (MojoExecutionException e) {\n    // check the path named in the message: create parent dir / fix permissions\n}","preventionTips":["Ensure target/ exists (run a prior build phase) before agent filter generation","Point agent filter file paths at writable directories","Monitor disk space in CI"],"tags":["maven","io","native-image","file-write"],"backgroundTag":"file-write-permission-denied","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"}