Trying to run a Daml Script compiled with SDK 2.2.0 against Daml Hub, getting cryptic error

Previously, I had a problem running a Daml Script compiled with SDK 2.3.2 against Daml Hub, and I learnt that there is an SDK bug which prevents this.

Now I have downgraded the SDK version to 2.2.0, and I’m trying to run a Daml Script against Daml Hub. For a certain Daml Script, I get this error message, what does it mean?

daml script \
  --participant-config ./participants.json \
  --json-api \
  --dar ./../.packages/init/.daml/dist/sor-mvp-init-0.0.1.dar \
  --script-name Init.Carrier:initCarrierRole \
  --input-file onboard_carrier_input.json.3n4 \
  --output-file ./initCarrier_result.json
Exception in thread "main" java.lang.IllegalArgumentException: Expected type 'Daml.Script.Script a' but got TApp(TApp(TBuiltin(BTArrow),TBuiltin(BTParty)),TApp(TTyCon(14b6ab6f094b98278dd07c0804235d90e1b6b65bfcacf0bc15fbaf0b0c4aa2dc:Daml.Script:Script),TApp(TBuiltin(BTContractId),TTyCon(e15415b3964947fae0c0c35b1eb978c92534309ebe6521220c57700ca3593313:Roles.Carrier:CarrierRole))))
        at com.daml.lf.data.package$.$anonfun$assertRight$1(package.scala:10)
        at scala.util.Either.fold(Either.scala:190)
        at com.daml.lf.data.package$.assertRight(package.scala:10)
        at com.daml.lf.engine.script.Runner$.run(Runner.scala:323)
        at com.daml.lf.engine.script.RunnerMain$.$anonfun$main$11(RunnerMain.scala:98)
        at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:470)
        at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:63)
        at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:100)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
        at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:94)
        at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:100)
        at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:49)
        at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48)
        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)
daml-helper: Received ExitFailure 1 when running
Raw command: java -Dlogback.configurationFile=/Users/gyorgybalazsi/.daml/sdk/2.2.0/daml-sdk/script-logback.xml -jar /Users/gyorgybalazsi/.daml/sdk/2.2.0/daml-sdk/daml-sdk.jar script --participant-config ./participants.json --json-api --dar ./../.packages/init/.daml/dist/sor-mvp-init-0.0.1.dar --script-name Init.Carrier:initCarrierRole --input-file onboard_carrier_input.json.3n4 --output-file ./initCarrier_result.json
2 Likes

I think this might be due to a mismatch between the SDK and Hub version, causing the package ID for Daml Script to differ from the expected one. The Daml Hub UI should show you the SDK version which is currently used as mentioned here.

I just noticed that you were in that very same thread. Is your ledger on Hub on 2.2.0?

No, it’s on 2.3.0, and as far as I understand I cannot influence that.

Moreover, another script compiled with SDK 2.2.0 works against another Daml Hub ledger, which also indicates in the ledger settings “Ledger SDK Version: 2.3.0”.

I create the ledgers with the damlhub cli and cannot influence “Ledger SDK Version”.

When I create a ledger manually, I have these options, which seems to indicate that I have pretty much flexibility here:

Then it looks like it’s not what I thought.

Have you explicitly declared the type of initCarrierRole, or started it with script do? If the former, what is its declared type?

1 Like

This is not an issue with the Hub version, this blows up on the client side.

It looks like your script is of type a -> Party -> Script CarrierRole where a is whatever you’re passing via input-file. You can only have one argument but you could group it in a tuple (a, Party).

2 Likes

I think Mortiz’s comment in the thread is on point: this looks like a client side error. If you compile this with a 2.3.2 SDK and run it against a local sandbox, I would expect you to see this problem as well. Is that correct?

1 Like

Thank you, Moritz, you are right.