quarkusio/quarkus · error · IllegalArgumentException

Code generation failed. Please check the log above for…

Error message

Code generation failed. Please check the log above for details.

What it means

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.

Solutions

  1. Add 'option java_package = "your.package.name";' to the offending .proto file (the file name is printed in the log above the error).
  2. Alternatively set 'option java_multiple_files = true;' together with java_package if you want per-type classes.
  3. Regenerate with mvn clean compile after editing the proto.
  4. Check build log entries above the failure — each offending proto/service is listed there.

Example fix

// before
syntax = "proto3";
service Greeter { rpc SayHello (HelloRequest) returns (HelloReply); }
// after
syntax = "proto3";
option java_package = "com.example.grpc";
service Greeter { rpc SayHello (HelloRequest) returns (HelloReply); }
Defensive patterns

Strategy: validation

Validate before calling

// check every proto before building
files.filter { it.endsWith(".proto") }.forEach { f ->
    val text = f.readText()
    require("option java_package" in text) { "${f.name}: missing option java_package" }
}

Try / catch

try {
    buildWithGrpcCodegen();
} catch (IllegalArgumentException e) {
    if (e.getMessage().contains("Code generation failed")) {
        // read log above for the proto file(s) lacking java_package and fix them
    } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: Copying protos from non-Java projects (no java_package option); migrating plain gRPC Java projects to Quarkus; hand-written minimal proto files.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/bd7d534ccc5782f7. Report an issue: GitHub.

Appendix: source

Thrown at extensions/grpc/protoc/src/main/java/io/quarkus/grpc/protoc/plugin/MutinyGrpcGenerator.java:72

                .collect(Collectors.toList());

        List<ServiceContext> services = findServices(protosToGenerate, typeMap);
        validateServices(services);
        return generateFiles(services);
    }

    private void validateServices(List<ServiceContext> services) {
        boolean failed = false;
        for (ServiceContext service : services) {
            if (service.packageName == null || service.packageName.isBlank()) {
                log.log(Level.SEVERE, "Using the default java package is not supported for "
                        + "Quarkus gRPC code generation. Please specify `option java_package = \"your.package\"` in "
                        + service.protoName);
                failed = true;
            }
        }
        if (failed) {
            throw new IllegalArgumentException("Code generation failed. Please check the log above for details.");
        }
    }

    private List<ServiceContext> findServices(List<DescriptorProtos.FileDescriptorProto> protos, ProtoTypeMap typeMap) {
        List<ServiceContext> contexts = new ArrayList<>();

        protos.forEach(fileProto -> {
            for (int serviceNumber = 0; serviceNumber < fileProto.getServiceCount(); serviceNumber++) {
                ServiceContext serviceContext = buildServiceContext(
                        fileProto.getService(serviceNumber),
                        typeMap,
                        fileProto.getSourceCodeInfo().getLocationList(),
                        serviceNumber);
                serviceContext.protoName = fileProto.getName();
                serviceContext.packageName = extractPackageName(fileProto);
                contexts.add(serviceContext);
            }
        });

View on GitHub (pinned to e1c734241f)