{"record":{"id":"d44d9b0625023732","repo":"quarkusio/quarkus","slug":"unable-to-copy-json-config-file-from-jsonpath-t","errorCode":null,"errorMessage":"Unable to copy json config file from ${jsonPath} to ${thinJarDirectory}","messagePattern":"Unable to copy json config file from (.+?) to (.+?)","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/pkg/jar/NativeImageSourceJarBuilder.java","lineNumber":125,"sourceCode":"\n    /**\n     * This is done in order to make application specific native image configuration files available to the native-image tool\n     * without the user needing to know any specific paths.\n     * The files that are copied don't end up in the native image unless the user specifies they are needed, all this method\n     * does is copy them to a convenient location\n     */\n    private static void copyJsonConfigFiles(ApplicationArchivesBuildItem applicationArchivesBuildItem, Path thinJarDirectory)\n            throws IOException {\n        for (Path root : applicationArchivesBuildItem.getRootArchive().getRootDirectories()) {\n            try (Stream<Path> stream = Files.find(root, 1, IsJsonFilePredicate.INSTANCE)) {\n                stream.forEach(new Consumer<Path>() {\n                    @Override\n                    public void accept(Path jsonPath) {\n                        try {\n                            Files.createDirectories(thinJarDirectory);\n                            Files.copy(jsonPath, thinJarDirectory.resolve(jsonPath.getFileName().toString()));\n                        } catch (IOException e) {\n                            throw new UncheckedIOException(\n                                    \"Unable to copy json config file from \" + jsonPath + \" to \" + thinJarDirectory,\n                                    e);\n                        }\n                    }\n                });\n            }\n        }\n    }\n\n    private static class IsJsonFilePredicate implements BiPredicate<Path, BasicFileAttributes> {\n\n        private static final BiPredicate<Path, BasicFileAttributes> INSTANCE = new IsJsonFilePredicate();\n\n        @Override\n        public boolean test(Path path, BasicFileAttributes basicFileAttributes) {\n            return basicFileAttributes.isRegularFile() && path.toString().endsWith(\".json\");\n        }\n    }","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/pkg/jar/NativeImageSourceJarBuilder.java#L107-L143","documentation":"NativeImageSourceJarBuilder wraps an IOException in an UncheckedIOException when copying a native-image JSON config file (e.g. from native-image properties/config) into the thin jar directory fails. The copy creates the thinJarDirectory then copies the JSON file, and any filesystem failure is rethrown with this descriptive message.","triggerScenarios":"Building the native image source jar with additional native-image JSON config files while the filesystem fails: thinJarDirectory cannot be created or the source jsonPath is unreadable (permissions, missing file, disk full, path is a directory).","commonSituations":"Read-only target/ directory; stale build processes locking files on Windows; a configured native-image config JSON path pointing to a file that was removed; insufficient disk space.","solutions":["Check file permissions on the source JSON file and the target build directory and ensure they are readable/writable.","Verify the jsonPath file exists (not deleted between configuration and packaging) and is a regular file.","Free disk space and run ./mvnw clean, then rebuild the native image source jar."],"exampleFix":"// before (config file missing)\nquarkus.native.additional-build-args=-H:ResourceConfigurationFiles=missing.json\n// after (ensure file exists and is readable)\nls -l src/main/resources/reflect-config.json\nquarkus.native.additional-build-args=-H:ResourceConfigurationFiles=src/main/resources/reflect-config.json","handlingStrategy":"try-catch","validationCode":"Path json = Path.of(\"src/main/resources/reflect-config.json\");\nif (!Files.isRegularFile(json) || !Files.isReadable(json)) {\n    throw new IllegalStateException(\"Native-image config JSON missing or unreadable: \" + json);\n}\nif (!Files.isWritable(targetDir)) {\n    throw new IllegalStateException(\"Thin jar directory not writable: \" + targetDir);\n}","typeGuard":null,"tryCatchPattern":"try {\n    Files.copy(jsonPath, thinJarDirectory.resolve(jsonPath.getFileName().toString()));\n} catch (IOException e) {\n    throw new IllegalStateException(\"Failed to copy native-image JSON config \" + jsonPath + \" to \" + thinJarDirectory\n        + \": check permissions, disk space, and that the source file exists\", e);\n}","preventionTips":["Verify all native-image JSON config paths exist before building.","Keep target/ free of stale locks and ensure sufficient disk space.","Check directory write permissions before running native packaging builds."],"tags":["quarkus","native-image","packaging","io-exception"],"backgroundTag":"file-copy-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"}