{"record":{"id":"a59de68f0a0a1252","repo":"quarkusio/quarkus","slug":"failed-to-read-bytecode-path","errorCode":null,"errorMessage":"Failed to read bytecode ${path}","messagePattern":"Failed to read bytecode (.+?)","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarTreeShakeInput.java","lineNumber":708,"sourceCode":"        final long size;\n\n        BytecodeSupplier(Path path) {\n            this.path = path;\n            long s = 0;\n            try {\n                s = Files.size(path);\n            } catch (IOException e) {\n                // ignore, size is only used for reporting\n            }\n            this.size = s;\n        }\n\n        @Override\n        public byte[] get() {\n            try (InputStream is = Files.newInputStream(path)) {\n                return is.readAllBytes();\n            } catch (IOException e) {\n                throw new UncheckedIOException(\"Failed to read bytecode \" + path, e);\n            }\n        }\n    }\n}\n","sourceCodeStart":690,"sourceCodeEnd":713,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarTreeShakeInput.java#L690-L713","documentation":"The tree-shaking input supplier lazily reads a class file's bytecode from the jar being analyzed (with filtered output). If Files.newInputStream throws an IOException (file missing, unreadable, corrupt), it wraps it in UncheckedIOException with the path, aborting the jar tree-shaking step.","triggerScenarios":"JarTreeShakeInput's BytecodeSupplier.get() is invoked (typically by the bytecode analysis consumer) and the class file path inside the exploded/temp jar cannot be opened: deleted temp files, permission errors, or a truncated jar extraction.","commonSituations":"Antivirus or another process deleting temp files mid-build; read-only build directories; corrupted dependency jars in ~/.m2; partially cleaned target directories during concurrent builds.","solutions":["Run mvn clean install (or clean package) to rebuild the exploded jar from scratch.","Check permissions/read-only flags on the target build directory.","Delete the affected dependency from ~/.m2 and re-resolve (mvn -U) if the source jar is corrupt.","Exclude the build directory from antivirus real-time scanning.","Avoid running two builds concurrently on the same project."],"exampleFix":"# before\n$ mvn package\n# after\n$ mvn clean package  # regenerates the exploded jar the tree-shaker reads","handlingStrategy":"try-catch","validationCode":"import java.nio.file.*;\nPath path = Path.of(\"target/...\");\nif (!Files.isReadable(path)) throw new IllegalStateException(\"Bytecode file not readable: \" + path);\nif (Files.size(path) == 0) throw new IllegalStateException(\"Bytecode file empty: \" + path);","typeGuard":null,"tryCatchPattern":"try {\n    // tree-shaking-enabled build\n} catch (UncheckedIOException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Failed to read bytecode\")) {\n        log.error(\"Corrupt/missing exploded jar, clean rebuild recommended\", e);\n    } else throw e;\n}","preventionTips":["mvn clean before package when switching branches or config.","Exclude build dirs from antivirus scanning.","Re-download corrupted dependencies (mvn -U after deleting from ~/.m2).","Avoid concurrent builds on the same workspace."],"tags":["tree-shaking","io","bytecode"],"backgroundTag":"file-read-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}