Skip to content
Discussions/App Development/io.grpc.StatusRuntimeException: INVALID_ARGUMENT: COMMAND_PREPROCESSING_FAILED: mismatching typeForum ↗

io.grpc.StatusRuntimeException: INVALID_ARGUMENT: COMMAND_PREPROCESSING_FAILED: mismatching type

App Development3 posts490 views4 likesLast activity Jun 2023
MR
Mr_MannorothOP
Jun 2023

I’m getting the following exception on submitting a submitAndWaitForTransaction command to my participant node:

io.grpc.StatusRuntimeException: INVALID_ARGUMENT: COMMAND_PREPROCESSING_FAILED(8,f85b23e7): mismatching type: Asset:Validate and value: ValueBool(false)
at io.grpc.Status.asRuntimeException(Status.java:535) ~[grpc-api-1.44.0.jar:1.44.0]
at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:534) ~[grpc-stub-1.44.0.jar:1.44.0]
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:562) ~[grpc-core-1.44.0.jar:1.44.0]
at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70) ~[grpc-core-1.44.0.jar:1.44.0]
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:743) ~[grpc-core-1.44.0.jar:1.44.0]
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:722) ~[grpc-core-1.44.0.jar:1.44.0]
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) ~[grpc-core-1.44.0.jar:1.44.0]
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133) ~[grpc-core-1.44.0.jar:1.44.0]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:1589) ~[na:na]

The relevant Daml code is below:

choice Validate : Either (ContractId Rejection) (ContractId Asset)
      with reject: Bool
      controller issuer
        do ...

The relevant Java code is below:

Command cmd = new CreateAndExerciseCommand(
      templateIdentifier,
      new DamlRecord(requestParams),
      "Validate"
      Bool.FALSE
    );
Transaction transaction = client.getCommandClient()
    .submitAndWaitForTransaction(
       CommandsSubmission
        .create(APP_ID, UUID.randomUUID().toString(), Collections.singletonList(cmd))
        .withActAs(Arrays.asList(party1, party2))
    ).blockingGet();

Any suggestions on what I’m doing wrong?

CO
cocreature
Jun 2023

The choice argument of Validate is not just the boolean but it’s a record called Validate with one field called reject and that has type boolean. You can see that more clearly when you have multiple fields in your choice argument.

So rather than just passing Bool.false you need to wrap that in another DamlRecord

MR
Mr_Mannoroth
Jun 2023

Perfect, thank you @cocreature!

← Back to Discussions