Problem Exercising a Choice from Java

Hi,

I am executing choices on live contracts from Java and at some point, unexpectedly since all arguments look kosher I get the following cryptic error that I can’t pinpoint. What should I look for that causes such exception stack?

 Caused by: java.util.concurrent.ExecutionException: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Command interpretation error in LF-DAMLe: Interpretation error: Error: User abort: fromSome: None. Details: Last location: [DA.Optional:27], partial transaction: <empty transaction>.
	at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:552)
	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:533)
	at io.reactivex.internal.operators.flowable.FlowableFromFuture.subscribeActual(FlowableFromFuture.java:42)
	at io.reactivex.Flowable.subscribe(Flowable.java:14478)
	at io.reactivex.internal.operators.flowable.FlowableSingleSingle.subscribeActual(FlowableSingleSingle.java:39)
	at io.reactivex.Single.subscribe(Single.java:3433)
	at io.reactivex.Single.blockingGet(Single.java:2694)
	... 21 more
Caused by: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Command interpretation error in LF-DAMLe: Interpretation error: Error: User abort: fromSome: None. Details: Last location: [DA.Optional:27], partial transaction: <empty transaction>.

Thanks for any pointer!

2 Likes

The key part of the error is ‘Error: User abort: fromSome: None’. It means you are using the function DA.Optional.fromSome in a value of None. That function is partial only. In cases where you may be dealing with a None, you need to pattern match or guard using isSome.

2 Likes