{"record":{"id":"b72dc41f84728a7e","repo":"quarkusio/quarkus","slug":"failed-to-compile-avro-idl-file-filepath-to-ja","errorCode":null,"errorMessage":"Failed to compile avro IDL file: ${filePath} to Java","messagePattern":"Failed to compile avro IDL file: (.+?) to Java","errorType":"exception","errorClass":"CodeGenException","httpStatus":null,"severity":"error","filePath":"extensions/avro/deployment/src/main/java/io/quarkus/avro/deployment/AvroIDLCodeGenProvider.java","lineNumber":56,"sourceCode":"            if (protocol != null) {\n                compiler = new SpecificCompiler(protocol);\n            } else {\n                compiler = new SpecificCompiler(idlFile.getNamedSchemas().values());\n            }\n\n            compiler.setTemplateDir(templateDirectory);\n            compiler.setStringType(options.stringType);\n            compiler.setFieldVisibility(SpecificCompiler.FieldVisibility.PRIVATE);\n            compiler.setCreateOptionalGetters(options.createOptionalGetters);\n            compiler.setGettersReturnOptional(options.gettersReturnOptional);\n            compiler.setOptionalGettersForNullableFieldsOnly(options.optionalGettersForNullableFieldsOnly);\n            compiler.setCreateSetters(options.createSetters);\n            compiler.setEnableDecimalLogicalType(options.enableDecimalLogicalType);\n\n            compiler.setOutputCharacterEncoding(\"UTF-8\");\n            compiler.compileToDestination(filePath.toFile(), outputDir.toFile());\n        } catch (IOException e) {\n            throw new CodeGenException(\"Failed to compile avro IDL file: \" + filePath.toString() + \" to Java\", e);\n        }\n    }\n}\n","sourceCodeStart":38,"sourceCodeEnd":60,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/avro/deployment/src/main/java/io/quarkus/avro/deployment/AvroIDLCodeGenProvider.java#L38-L60","documentation":"Quarkus Avro's IDL code generator wraps IOException from the Avro IDL compiler (org.apache.avro.idl.IDLCompiler / Compiler) when compiling a .avdl file to Java during code-gen phase. It signals that the Avro IDL file could not be read or parsed/compiled successfully. The underlying cause is chained in the CodeGenException.","triggerScenarios":"Running './mvnw compile' (or Quarkus dev mode) with an .avdl file under src/main/avro whose content fails IDL parsing, references unknown imports/protocols, or whose file cannot be read from disk.","commonSituations":"Syntax errors in the .avdl IDL; missing @namespace or unresolved imports; unreadable file due to permissions or wrong encoding; Avro version incompatibility with newer IDL syntax.","solutions":["Read the chained 'Caused by' exception for the exact IDL parse error and fix the .avdl syntax at the reported line","Verify the .avdl file is valid with Avro's standalone tools (avro-tools/idl) outside Maven","Check imports/protocol references in the IDL resolve to files in the same source directory","Confirm file read permissions and UTF-8 encoding of the .avdl file"],"exampleFix":"// before (broken IDL)\nprotocol MyProto {\n  record User { string name; int age }\n  // missing closing brace for record\n}\n// after\nprotocol MyProto {\n  record User { string name; int age; }\n}","handlingStrategy":"validation","validationCode":"// before build, sanity-check IDL files\nFiles.walk(Path.of(\"src/main/avro\")).filter(p -> p.toString().endsWith(\".avdl\")).forEach(p -> {\n    try { new org.apache.avro.idl.IdlFile(p).compile(); }\n    catch (Exception e) { throw new IllegalStateException(\"Invalid IDL: \" + p + \": \" + e.getMessage(), e); }\n});","typeGuard":null,"tryCatchPattern":"try {\n    project.build();\n} catch (CodeGenException e) {\n    Throwable cause = e.getCause(); // inspect actual IDL parse error\n    log.error(\"Avro IDL compile failed: \" + (cause != null ? cause.getMessage() : e.getMessage()));\n}","preventionTips":["Validate .avdl files with avro-tools in CI before building","Keep IDL imports in the same directory tree","Never hand-edit generated code; fix the IDL source","Pin one Avro version across modules"],"tags":["avro","codegen","idl","quarkus"],"backgroundTag":"avro-idl-compilation-failed","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"}