Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Issue in proto migration with regards to scala

63 views
Skip to first unread message

Karthik Rao

unread,
Feb 3, 2025, 3:47:43 PMFeb 3
to Protocol Buffers
Hi ,

Need help in how to debug this error?

Context:
Migrating rules_proto_grpc(bazel) from 2.0.0 to 5.0.1 .
In the course of migration, migrated 
- io_bazel_rules_scala from 6.4.0 to 6.6.0 
- protobuf to v27.5
- scalapb plugin from 0.9.7 to 0.11.17

There were a couple of issues in the migration, and resolving each finally led to this error.
I am certain, the bazel resolves to protobuf 27.5 and protobuf java is 4.27.5. I also patched io_bazel_rules_scala to use the proper versions above. 

Any idea on how to go about debugging this? 
```

ERROR: /private/var/tmp/_bazel_karthik.arn/d3b27aca523d2621bb5103f7332515c5/external/com_google_protobuf/src/google/protobuf/BUILD.bazel:101:14: ProtoScalaPBRule external/com_google_protobuf/src/google/protobuf/timestamp_proto_scala_scalapb.srcjar failed: (Exit 1): scalapb_worker failed: error executing ProtoScalaPBRule command (from target @@com_google_protobuf//src/google/protobuf:timestamp_proto) bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/external/io_bazel_rules_scala/src/scala/scripts/scalapb_worker ... (remaining 2 arguments skipped)

--scala_out: java.lang.NoSuchMethodError: 'java.lang.Object com.google.protobuf.DescriptorProtos$FieldOptions.getExtension(com.google.protobuf.GeneratedMessage$GeneratedExtension)'

at scalapb.compiler.DescriptorImplicits$ExtendedFieldDescriptor.fieldOptions(DescriptorImplicits.scala:329)

at scalapb.compiler.DescriptorImplicits$ExtendedFieldDescriptor.scalaName(DescriptorImplicits.scala:207)

at scalapb.compiler.ProtoValidation.validateField(ProtoValidation.scala:121)

at scalapb.compiler.ProtoValidation.$anonfun$validateMessage$3(ProtoValidation.scala:56)

at scalapb.compiler.ProtoValidation.$anonfun$validateMessage$3$adapted(ProtoValidation.scala:56)

at scala.collection.Iterator.foreach(Iterator.scala:943)

at scala.collection.Iterator.foreach$(Iterator.scala:943)

at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)

at scala.collection.IterableLike.foreach(IterableLike.scala:74)

at scala.collection.IterableLike.foreach$(IterableLike.scala:73)

at scala.collection.AbstractIterable.foreach(Iterable.scala:56)

at scalapb.compiler.ProtoValidation.validateMessage(ProtoValidation.scala:56)

at scalapb.compiler.ProtoValidation.$anonfun$validateFile$2(ProtoValidation.scala:17)

at scalapb.compiler.ProtoValidation.$anonfun$validateFile$2$adapted(ProtoValidation.scala:17)

at scala.collection.Iterator.foreach(Iterator.scala:943)

at scala.collection.Iterator.foreach$(Iterator.scala:943)

at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)

at scala.collection.IterableLike.foreach(IterableLike.scala:74)

at scala.collection.IterableLike.foreach$(IterableLike.scala:73)

at scala.collection.AbstractIterable.foreach(Iterable.scala:56)

at scalapb.compiler.ProtoValidation.validateFile(ProtoValidation.scala:17)

at scalapb.compiler.ProtoValidation.$anonfun$validateFiles$1(ProtoValidation.scala:10)

at scalapb.compiler.ProtoValidation.$anonfun$validateFiles$1$adapted(ProtoValidation.scala:10)

at scala.collection.Iterator.foreach(Iterator.scala:943)

at scala.collection.Iterator.foreach$(Iterator.scala:943)

at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)

at scala.collection.IterableLike.foreach(IterableLike.scala:74)

at scala.collection.IterableLike.foreach$(IterableLike.scala:73)

at scala.collection.AbstractIterable.foreach(Iterable.scala:56)

at scalapb.compiler.ProtoValidation.validateFiles(ProtoValidation.scala:10)

at scalapb.compiler.ProtobufGenerator$.handleCodeGeneratorRequest(ProtobufGenerator.scala:1763)

at scalapb.ScalaPbCodeGenerator$.process(ScalaPbCodeGenerator.scala:16)

at protocgen.CodeGenApp.run(CodeGenApp.scala:48)

at protocgen.CodeGenApp.run$(CodeGenApp.scala:41)

at scalapb.ScalaPbCodeGenerator$.run(ScalaPbCodeGenerator.scala:11)

at protocgen.CodeGenApp.run(CodeGenApp.scala:33)

at protocgen.CodeGenApp.run$(CodeGenApp.scala:32)

at scalapb.ScalaPbCodeGenerator$.run(ScalaPbCodeGenerator.scala:11)

at protocbridge.frontend.PluginFrontend$.runWithBytes(PluginFrontend.scala:48)

at protocbridge.frontend.PluginFrontend$.runWithInputStream(PluginFrontend.scala:113)

at protocbridge.frontend.SocketBasedPluginFrontend.$anonfun$prepare$2(SocketBasedPluginFrontend.scala:31)

at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)

at scala.concurrent.impl.ExecutionContextImpl$DefaultThreadFactory$$anon$1$$anon$2.block(ExecutionContextImpl.scala:75)

at java.base/java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3118)

at scala.concurrent.impl.ExecutionContextImpl$DefaultThreadFactory$$anon$1.blockOn(ExecutionContextImpl.scala:87)

at scala.concurrent.package$.blocking(package.scala:146)

at protocbridge.frontend.SocketBasedPluginFrontend.$anonfun$prepare$1(SocketBasedPluginFrontend.scala:23)

at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)

at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:659)

at scala.util.Success.$anonfun$map$1(Try.scala:255)

at scala.util.Success.map(Try.scala:213)

at scala.concurrent.Future.$anonfun$map$1(Future.scala:292)

at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33)

at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33)

at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)

at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)

at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)

at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)

at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)

at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)

at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

```

Brian Metras

unread,
Feb 3, 2025, 5:47:10 PMFeb 3
to Karthik Rao, Protocol Buffers

Seems to be related to a version mismatch or an incompatibility between the versions of the libraries you're using.

Here are a few steps you can take to debug this issue:

1. **Check Compatibility**: Ensure that all the versions of the libraries you're using are compatible with each other. Sometimes, upgrading one library can cause issues with another if they're not designed to work together.

2. **Review Dependencies**: Double-check your `WORKSPACE` or `MODULE.bazel` file to make sure that all dependencies are correctly specified and that there are no conflicts.

3. **Clean Build Cache**: Try cleaning your Bazel build cache and rebuilding your project. This can sometimes resolve issues caused by stale or corrupted files. You can do this by running:
   ```bash
   bazel clean --expunge
   ```

4. **Isolate the Issue**: Try to isolate the issue by creating a minimal example that reproduces the error. This can help you identify whether the problem is specific to your project or a more general issue with the libraries.

5. **Consult Documentation**: Check the documentation for `rules_proto_grpc`, `io_bazel_rules_scala`, and `scalapb` to see if there are any known issues or migration guides that might help.

6. **Seek Community Help**: If you're still stuck, consider reaching out to the larger community for help. You can post your issue on GitHub or relevant forums, providing as much detail as possible.

Good Luck

Brian Metras

315-802-8784 cell/text
   

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/protobuf/ae0fc8c9-d827-424e-93aa-66d81e5df772n%40googlegroups.com.

Karthik Rao

unread,
Feb 16, 2025, 4:54:39 PMFeb 16
to Brian Metras, Protocol Buffers
Reply all
Reply to author
Forward
0 new messages