quarkusio/quarkus · error · IllegalStateException

File name already used: ${name}

Error message

File name already used: ${name}

What it means

While recursively indexing FileDescriptors for gRPC server reflection, each proto file name must map to exactly one FileDescriptor. processFileDescriptor throws this IllegalStateException if a FileDescriptor with the same name was already recorded.

Source

Thrown at extensions/grpc/reflection/src/main/java/io/quarkus/grpc/reflection/service/GrpcServerIndex.java:108

    }

    public FileDescriptor getFileDescriptorByExtensionAndNumber(String type, int number) {
        Map<Integer, FileDescriptor> map = descriptorsByExtensionAndNumber
                .getOrDefault(type, Collections.emptyMap());
        return map.get(number);
    }

    public Set<Integer> getExtensionNumbersOfType(String type) {
        return descriptorsByExtensionAndNumber.getOrDefault(type, Collections.emptyMap()).keySet();
    }

    private void processFileDescriptor(FileDescriptor fd,
            Map<String, FileDescriptor> descriptorsByName,
            Map<String, FileDescriptor> descriptorsBySymbol,
            Map<String, Map<Integer, FileDescriptor>> descriptorsByExtensionAndNumber) {
        String name = fd.getName();
        if (descriptorsByName.containsKey(name)) {
            throw new IllegalStateException("File name already used: " + name);
        }
        descriptorsByName.put(name, fd);
        for (Descriptors.ServiceDescriptor service : fd.getServices()) {
            processService(service, fd, descriptorsBySymbol);
        }
        for (Descriptors.Descriptor type : fd.getMessageTypes()) {
            processType(type, fd, descriptorsBySymbol, descriptorsByExtensionAndNumber);
        }
        for (Descriptors.FieldDescriptor extension : fd.getExtensions()) {
            processExtension(extension, fd, descriptorsByExtensionAndNumber);
        }
    }

    private void processService(Descriptors.ServiceDescriptor service, FileDescriptor fd,
            Map<String, FileDescriptor> descriptorsBySymbol) {
        String fullyQualifiedServiceName = service.getFullName();
        if (descriptorsBySymbol.containsKey(fullyQualifiedServiceName)) {
            throw new IllegalStateException("Service already defined: " + fullyQualifiedServiceName);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Run mvn dependency:tree to find artifacts shipping the same .proto name and exclude the duplicate.
  2. Rename your own proto files to be project-unique (avoid generic names like common.proto).
  3. If a transitive dependency duplicates protos, use Maven exclusions or a dependency management pin to a single version.
  4. Ensure only one version of the library that generates those descriptors is on the runtime classpath.

Example fix

// before (two jars bundle)
proto/common.proto
// after (exclude one)
<exclusion><groupId>com.example</groupId><artifactId>legacy-sdk</artifactId></exclusion>
Defensive patterns

Strategy: try-catch

Try / catch

try {
    startServer();
} catch (IllegalStateException e) {
    if (e.getMessage().startsWith("File name already used:")) {
        // find the jar shipping a second copy of that .proto and exclude it
    } else throw e;
}

Prevention

When it happens

Trigger: Two ServiceDefinitions whose schema descriptors resolve to FileDescriptors with the same file name (e.g. the same .proto name defined in two different jars/versions on the classpath).

Common situations: Same proto file name in two dependency jars (common.proto, empty.proto collisions); shaded/duplicated proto artifacts; two versions of an SDK both bundling the same proto.

Related errors


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