{"record":{"id":"bd7d534ccc5782f7","repo":"quarkusio/quarkus","slug":"code-generation-failed-please-check-the-log-above","errorCode":null,"errorMessage":"Code generation failed. Please check the log above for details.","messagePattern":"Code generation failed\\. Please check the log above for details\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/grpc/protoc/src/main/java/io/quarkus/grpc/protoc/plugin/MutinyGrpcGenerator.java","lineNumber":72,"sourceCode":"                .collect(Collectors.toList());\n\n        List<ServiceContext> services = findServices(protosToGenerate, typeMap);\n        validateServices(services);\n        return generateFiles(services);\n    }\n\n    private void validateServices(List<ServiceContext> services) {\n        boolean failed = false;\n        for (ServiceContext service : services) {\n            if (service.packageName == null || service.packageName.isBlank()) {\n                log.log(Level.SEVERE, \"Using the default java package is not supported for \"\n                        + \"Quarkus gRPC code generation. Please specify `option java_package = \\\"your.package\\\"` in \"\n                        + service.protoName);\n                failed = true;\n            }\n        }\n        if (failed) {\n            throw new IllegalArgumentException(\"Code generation failed. Please check the log above for details.\");\n        }\n    }\n\n    private List<ServiceContext> findServices(List<DescriptorProtos.FileDescriptorProto> protos, ProtoTypeMap typeMap) {\n        List<ServiceContext> contexts = new ArrayList<>();\n\n        protos.forEach(fileProto -> {\n            for (int serviceNumber = 0; serviceNumber < fileProto.getServiceCount(); serviceNumber++) {\n                ServiceContext serviceContext = buildServiceContext(\n                        fileProto.getService(serviceNumber),\n                        typeMap,\n                        fileProto.getSourceCodeInfo().getLocationList(),\n                        serviceNumber);\n                serviceContext.protoName = fileProto.getName();\n                serviceContext.packageName = extractPackageName(fileProto);\n                contexts.add(serviceContext);\n            }\n        });","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/grpc/protoc/src/main/java/io/quarkus/grpc/protoc/plugin/MutinyGrpcGenerator.java#L54-L90","documentation":"Quarkus gRPC protoc plugin validation: while generating Mutiny stubs, each service in the proto must have an explicit java_package option (or usable java package info). If any service's proto lacks it, validation sets failed=true and throws this IllegalArgumentException, instructing the developer to read the log lines printed just above the error for the offending proto file.","triggerScenarios":"Running a Quarkus build with a .proto file that declares services but no 'option java_package = \"your.package\";' — the plugin's validateServices step fails before generating files.","commonSituations":"Copying protos from non-Java projects (no java_package option); migrating plain gRPC Java projects to Quarkus; hand-written minimal proto files.","solutions":["Add 'option java_package = \"your.package.name\";' to the offending .proto file (the file name is printed in the log above the error).","Alternatively set 'option java_multiple_files = true;' together with java_package if you want per-type classes.","Regenerate with mvn clean compile after editing the proto.","Check build log entries above the failure — each offending proto/service is listed there."],"exampleFix":"// before\nsyntax = \"proto3\";\nservice Greeter { rpc SayHello (HelloRequest) returns (HelloReply); }\n// after\nsyntax = \"proto3\";\noption java_package = \"com.example.grpc\";\nservice Greeter { rpc SayHello (HelloRequest) returns (HelloReply); }","handlingStrategy":"validation","validationCode":"// check every proto before building\nfiles.filter { it.endsWith(\".proto\") }.forEach { f ->\n    val text = f.readText()\n    require(\"option java_package\" in text) { \"${f.name}: missing option java_package\" }\n}","typeGuard":null,"tryCatchPattern":"try {\n    buildWithGrpcCodegen();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"Code generation failed\")) {\n        // read log above for the proto file(s) lacking java_package and fix them\n    } else throw e;\n}","preventionTips":["Always declare option java_package in every Java-targeted proto","Add a pre-commit lint that scans .proto files for java_package","Share a base proto template with the option included","Run a quick mvn compile after editing protos"],"tags":["grpc","protobuf","quarkus","codegen","proto-config"],"backgroundTag":"missing-java-package-option","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"}