2

I'm building an API to host on Google API Gateway.

A recent change was to integrate with protovalidate for simple request validation.

Upon doing so, I began getting the following error when pushing my proto descriptor to API Gateway:

Error: Error creating ApiConfig: googleapi: Error 400: Invalid file descriptor set "./../../api-config/build/descriptors/api_descriptor.pb": generic::invalid_argument: Invalid file descriptor set "./../../api-config/build/descriptors/api_descriptor.pb": proto: message field "buf.validate.FieldPathElement.field_type" cannot resolve type: "google.protobuf.FieldDescriptorProto.Type" not found

I'm using gradle to build the descriptor, but I get this error when I manually run protoc and explicitly include the google.protobuf.descriptor.proto as well. At this point I'm at a loss for how to fi this issue. It occurs as soon as I include protovalidate as part of the build, even if it's not used in my protos.

Here's my current gradle file, some lines commented out to reduce build scope in an attempt to identify the issue:

import com.google.protobuf.gradle.*
import java.nio.file.Paths
plugins {
 id("kotlin")
 id("com.google.protobuf")
}
repositories {
 mavenCentral()
}
// ---- Versions ----
val protobufVersion = "4.31.1"
val grpcVersion = "1.71.0"
val grpcKotlinVersion = "1.4.3"
val protoValidateVersion = "0.12.0"
 // api("io.grpc:grpc-kotlin-stub:$grpcKotlinVersion")
 // api("com.google.protobuf:protobuf-kotlin:$protobufVersion")
 api("com.google.protobuf:protobuf-java:$protobufVersion")
 // implementation("io.grpc:grpc-protobuf:$grpcVersion")
 protobuf("com.google.api.grpc:proto-google-common-protos:2.41.0") // has google/api/*.proto
 // protobuf("com.google.protobuf:protoc:$protobufVersion")
 protobuf("build.buf:protovalidate:$protoValidateVersion")
}
sourceSets {
 named("main") {
 proto {
 srcDir("$projectDir/proto") 
 include("**.*.proto")
 }
 }
}
protobuf {
 protoc { artifact = "com.google.protobuf:protoc:$protobufVersion" }
 plugins {
 // create("grpc") { artifact = "io.grpc:protoc-gen-grpc-java:$grpcVersion" }
 // create("grpckt") { artifact = "io.grpc:protoc-gen-grpc-kotlin:$grpcKotlinVersion:jdk8@jar" }
 }
 generateProtoTasks {
 all().configureEach {
 // Kotlin message classes
 // builtins { 
 // create("kotlin")
 // }
 // JVM/Kotlin stubs
 // plugins {
 // create("grpc")
 // create("grpckt")
 // }
 // Produce a descriptor set we can hand to Terraform
 
 this as GenerateProtoTask
 generateDescriptorSet = true
 descriptorSetOptions.apply {
 path = "$buildDir/descriptors/api_descriptor.pb"
 includeImports = true
 includeSourceInfo = true
 }
 }
 }
}

I've attempted the following with the same results:

  • Building the descriptor with protoc directly
  • Explicitly including the google.protobuf library
  • Explicitly including the google.protobuf.descriptor file as a source

Removing the protovalidate dependency fixes the issue, but of course that means I don't get protovalidate functionality.

asked Sep 5, 2025 at 15:10
7
  • Can you include a minimal repro? What protoc equivalent command did you use? Are you ensuring that descriptor.proto is included for FileDescriptorProto.Type? Commented Sep 6, 2025 at 4:33
  • Here's a simple reproduction of the issue: drive.google.com/file/d/1VzYnVj0cwZ8h3GpMRD6jeQ-W7KFD-HN4/… I did ensure the descriptor.proto file was included when I manually ran protoc: ``` protoc \ -I api-config/build/extracted-protos/main \ -I api-config/build/extracted-include-protos/main \ -I api-config/proto \ --include_imports \ --include_source_info \ --descriptor_set_out=api-config/build/descriptors/manual_desc.pb \ api-config/proto/message_analysis_service.proto \ google/protobuf/descriptor.proto ``` Commented Sep 7, 2025 at 4:44
  • Thank you! I'll try to replicate/resolve. It will be either later this morning or tomorrow. Commented Sep 7, 2025 at 15:19
  • I have insufficient information to help. The Drive file is incomplete. If you can provide a minimal repro of your issue, that would help. Absent this, I took the example on the protovalidate repo and am able to compile it with protoc without issue to a descriptor. Commented Sep 7, 2025 at 18:24
  • 1
    issuetracker.google.com/issues/399449171 Commented Sep 9, 2025 at 21:19

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.