Skip to content

IllegalArgumentException: FieldDescriptor does not match message type when using protobuf.Any #295

@SanjayVas

Description

@SanjayVas

I get the following error when my var is a protobuf.Any message:

java.lang.IllegalArgumentException: FieldDescriptor does not match message type.

Stack trace:

com.google.protobuf.DynamicMessage.verifyContainingType(DynamicMessage.java:306)
	at com.google.protobuf.DynamicMessage.getField(DynamicMessage.java:195)
	at org.projectnessie.cel.common.types.pb.FieldDescription.getValueFromField(FieldDescription.java:447)
	at org.projectnessie.cel.common.types.pb.FieldDescription.getField(FieldDescription.java:438)
	at org.projectnessie.cel.common.types.pb.PbObjectT.get(PbObjectT.java:77)
	at org.projectnessie.cel.interpreter.AttributeFactory.refResolve(AttributeFactory.java:1222)
	at org.projectnessie.cel.interpreter.AttributeFactory$StringQualifier.qualify(AttributeFactory.java:840)
	at org.projectnessie.cel.interpreter.AttributeFactory$AbsoluteAttribute.tryResolve(AttributeFactory.java:363)
	at org.projectnessie.cel.interpreter.AttributeFactory$AbsoluteAttribute.resolve(AttributeFactory.java:341)
	at org.projectnessie.cel.interpreter.Interpretable$EvalAttr.eval(Interpretable.java:1698)
	at org.projectnessie.cel.interpreter.Interpretable$EvalBinary.eval(Interpretable.java:647)
	at org.projectnessie.cel.Prog.eval(Prog.java:89)

cel-java version: 0.3.11

Using a debugger at FieldDescription.getValueFromField, it appears that message is an instance of DynamicMessage with type.fullName equal to google.protobuf.Any. This has the correct type URL set. The FieldDescriptor has containingType.fullName equal to the concrete message type that the type URL resolves to.

I imagine that something is going wrong in unpacking. I've specified the message type in EnvOptions using a DynamicMessage from a Descriptor which was built from a FileDecriptorSet. In my test scenario, that message type also happens to be compiled in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions