quarkusio/quarkus · error · CodeGenException

Failed to find ${location} among dependencies

Error message

Failed to find ${location} among dependencies

What it means

During gRPC code generation Quarkus needs native protoc and protoc-gen-grpc-java binaries matching the OS classifier (e.g. linux-x86_64). makeExecutableFromPath throws this CodeGenException when neither a previously copied executable nor the matching artifact (groupId:artifactId:classifier:packaging) is found among the application's resolved dependencies.

Source

Thrown at extensions/grpc/codegen/src/main/java/io/quarkus/grpc/codegen/GrpcCodeGen.java:513

    private Path prepareExecutable(Path buildDir, ApplicationModel model,
            String groupId, String artifactId, String classifier, String packaging) throws CodeGenException {
        Path artifactPath = findArtifactPath(model, groupId, artifactId, classifier, packaging);

        return makeExecutableFromPath(buildDir, groupId, artifactId, classifier, packaging, artifactPath);
    }

    private Path makeExecutableFromPath(Path buildDir, String groupId, String artifactId, String classifier, String packaging,
            Path artifactPath) throws CodeGenException {
        Path exe = buildDir.resolve(String.format("%s-%s-%s-%s", groupId, artifactId, classifier, packaging));

        if (Files.exists(exe)) {
            return exe;
        }

        if (artifactPath == null) {
            String location = String.format("%s:%s:%s:%s", groupId, artifactId, classifier, packaging);
            throw new CodeGenException("Failed to find " + location + " among dependencies");
        }

        try {
            Files.copy(artifactPath, exe, StandardCopyOption.REPLACE_EXISTING);
        } catch (IOException e) {
            throw new CodeGenException("Failed to copy file: " + artifactPath + " to " + exe, e);
        }
        if (!exe.toFile().setExecutable(true)) {
            throw new CodeGenException("Failed to make the file executable: " + exe);
        }
        return exe;
    }

    private static Path findArtifactPath(ApplicationModel model, String groupId, String artifactId, String classifier,
            String packaging) {
        Path artifactPath = null;

        for (ResolvedDependency artifact : model.getDependencies()) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Verify io.quarkus:quarkus-grpc (and its platform BOM) is on the build classpath so protoc artifacts are managed transitively
  2. Check dependencyManagement/exclusions are not filtering the native classifier artifacts (com.google.protobuf:protoc, io.grpc:protoc-gen-grpc-java)
  3. Run with -X or inspect the resolved dependency list to confirm the exe-classified artifact resolves from your repository/mirror
  4. Set the system property -Dquarkus.grpc.protoc-path=/path/to/protoc to supply your own protoc binary, bypassing the lookup
  5. Override -Dquarkus.grpc.protoc-os-classifier to force a classifier that exists in your repository

Example fix

// before: excluding native artifacts
globalExcludes.add("com.google.protobuf:*");
// after: allow protoc native classifier or supply binary explicitly
mvn -Dquarkus.grpc.protoc-path=/usr/local/bin/protoc clean compile
Defensive patterns

Strategy: validation

Validate before calling

// confirm the native protoc artifact resolves before building
dependencyTree.resolve("com.google.protobuf:protoc:exe:" + osClassifier);
// or check manually:
// mvn dependency:tree -Dincludes=com.google.protobuf:protoc

Try / catch

try {
    build.run();
} catch (CodeGenException e) {
    if (e.getMessage().contains("Failed to find") && e.getMessage().contains("among dependencies")) {
        // fall back to a locally installed protoc
        System.setProperty("quarkus.grpc.protoc-path", "/usr/local/bin/protoc");
        build.run();
    }
}

Prevention

When it happens

Trigger: Running code generation where the dependency model does not contain e.g. com.google.protobuf:protoc:exe:linux-x86_64 or io.grpc:protoc-gen-grpc-java:exe:<classifier> — typically because the quarkus-grpc extension's managed protoc artifacts were excluded, the platform BOM was overridden, or the OS classifier string does not match any published binary.

Common situations: Custom dependency management excluding '*:exe' classifier artifacts; a corporate repository mirror missing native classifier artifacts; uncommon OS/arch combination (e.g. linux-aarch_64 variants) with no matching binary; overriding the protobuf/grpc version in dependencyManagement so the classifier entry changed.

Related errors


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