{"record":{"id":"9871dbc38a6f341f","repo":"quarkusio/quarkus","slug":"failed-to-copy-compiled-files-to-output-directory","errorCode":null,"errorMessage":"Failed to copy compiled files to output directory ${outputDirectory.toAbsolutePath()}","messagePattern":"Failed to copy compiled files to output directory (.+?)","errorType":"exception","errorClass":"CodeGenException","httpStatus":null,"severity":"error","filePath":"extensions/avro/deployment/src/main/java/io/quarkus/avro/deployment/AvroSchemaCodeGenProvider.java","lineNumber":85,"sourceCode":"        compiler.setEnableDecimalLogicalType(options.enableDecimalLogicalType);\n        compiler.setOutputCharacterEncoding(\"UTF-8\");\n        compiler.addCustomConversion(Conversions.UUIDConversion.class);\n\n        for (String customConversion : options.customConversions) {\n            try {\n                Class<?> conversionClass = Class.forName(customConversion);\n                if (!conversionClass.isInstance(Conversions.UUIDConversion.class)) {\n                    compiler.addCustomConversion(conversionClass);\n                }\n            } catch (ClassNotFoundException e) {\n                throw new CodeGenException(\"Unable to find the following conversion class: \" + customConversion, e);\n            }\n        }\n\n        try {\n            compiler.compileToDestination(file, outputDirectory.toFile());\n        } catch (IOException e) {\n            throw new CodeGenException(\"Failed to copy compiled files to output directory \" +\n                    outputDirectory.toAbsolutePath(), e);\n        }\n    }\n}\n","sourceCodeStart":67,"sourceCodeEnd":90,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/avro/deployment/src/main/java/io/quarkus/avro/deployment/AvroSchemaCodeGenProvider.java#L67-L90","documentation":"After compiling the schema, SpecificCompiler.compileToDestination writes generated Java sources into the target output directory. If that write fails with IOException, Quarkus wraps it in this CodeGenException reporting the output directory path. It means generated sources could not be written/copied to disk.","triggerScenarios":"compileToDestination throws while writing generated .java files: output dir is not writable, is a file instead of a directory, or disk I/O fails.","commonSituations":"target/ directory locked or owned by another user (e.g. files created by a container as root); read-only filesystem in CI; path conflict where outputDirectory exists as a regular file; full disk.","solutions":["Check write permissions on the reported output directory (and fix ownership if created by root/docker)","Run mvn clean to remove a stale/locked target directory and rebuild","Ensure the output path is a directory, not a file, and the disk has free space","On CI, verify the workspace mount is writable"],"exampleFix":"// shell, before\nls -ld target/generated-sources/avro  # owned by root, not writable\n// after\nsudo chown -R $(whoami) target && ./mvnw clean compile","handlingStrategy":"validation","validationCode":"Path out = Path.of(\"target/generated-sources/avro\");\nif (Files.exists(out) && !Files.isDirectory(out)) {\n    throw new IllegalStateException(\"Output path is a file, not a directory: \" + out);\n}\nif (!Files.isWritable(out.getParent() != null ? out.getParent() : Path.of(\"target\"))) {\n    throw new IllegalStateException(\"Output directory not writable: \" + out);\n}","typeGuard":null,"tryCatchPattern":"try {\n    project.build();\n} catch (CodeGenException e) {\n    log.error(\"Cannot write generated Avro sources: \" + e.getMessage());\n    log.error(\"Check permissions/ownership of the output directory\");\n}","preventionTips":["Don't run builds that create root-owned files inside containers then reuse target/ from host","Run mvn clean when target/ state is suspect","Ensure CI workspaces and Docker volumes are writable by the build user","Monitor disk space on build agents"],"tags":["avro","codegen","io","filesystem","quarkus"],"backgroundTag":"output-directory-not-writable","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"}