Skip to content
CCPEDIAby Unity Nodes
App Development

Error when trying to run Daml Script against Daml Hub - again

3 posts276 views2 likesLast activity Sep 2022

  1. gyorgybalazsiOP

    Update: with SDK 2.0.0 it’s working.

    Formerly I had issues with this, there were cases when I made a mistake, and there was word about a bug in the Daml SDK which caused issued with this.

    Now I’m trying to do this with Daml 2.3.4 and cannot figure out if I’m making some stupid mistake or we still have a bug.

    I’m doing this with a slightly modified version of the skeleton template.

    This is the script, the setup' version with local party allocation works fine.:

    data Parties = Parties with 
      alice : Party 
      bob : Party 
    
    setupFromParties : Parties -> Script ()
    setupFromParties Parties{..} = do 
      aliceTV <- submit alice do
        createCmd Asset with
          issuer = alice
          owner = alice
          name = "TV"
    
      bobTV <- submit alice do
        exerciseCmd aliceTV Give with newOwner = bob
    
      submit bob do
        exerciseCmd bobTV Give with newOwner = alice
      return ()
    
    allocateParties = do 
      alice <- allocateParty "allice"
      bob <- allocateParty "bob"
      return Parties with ..
    
    setup' : Script ()
    setup' = allocateParties >>= setupFromParties
    

    The Bash script I’m running:

    daml script \
      --dar .daml/dist/test-script-0.0.1.dar \
      --participant-config ./participants.json \
      --json-api \
      --script-name Main:setupFromParties \
      --input-file ./ledger-parties.json
    

    The ledger-parties.json contains other parties than alice and bob but formerly this didn’t cause any problems:

    {
        "info_rtledgers_com": "ledger-party-bee58a4a-67cc-4e5a-96df-f050e6e72d77::12208491f72b6ebd33811d3032d30e3e4742c644e8ac3afe2186805f70b651479097",
        "alice": "ledger-party-7a1eaa24-9157-4c12-b4cf-e23bcd968401::12208491f72b6ebd33811d3032d30e3e4742c644e8ac3afe2186805f70b651479097",
        "bob": "ledger-party-ab7d65c2-d5ea-4225-b9aa-f2630fe3ca7b::12208491f72b6ebd33811d3032d30e3e4742c644e8ac3afe2186805f70b651479097",
        "public": "public::12208491f72b6ebd33811d3032d30e3e4742c644e8ac3afe2186805f70b651479097",
        "userAdmin": "useradmin::12208491f72b6ebd33811d3032d30e3e4742c644e8ac3afe2186805f70b651479097"
    }
    

    The error I get:

    Exception in thread "main" java.util.NoSuchElementException: None.get
            at scala.None$.get(Option.scala:627)
            at scala.None$.get(Option.scala:626)
            at com.daml.lf.engine.script.RunnerMain$.$anonfun$main$9(RunnerMain.scala:108)
            at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:467)
            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.3.4/daml-sdk/script-logback.xml -jar /Users/gyorgybalazsi/.daml/sdk/2.3.4/daml-sdk/daml-sdk.jar script --dar .daml/dist/test-script-0.0.1.dar --participant-config ./participants.json --json-api --script-name Main:setupFromParties --input-file ./ledger-parties.json
    
  2. cocreature 2

    Same issue as Cryptic error message when trying to run a Daml Script against Daml Hub - #2 by cocreature. It will be fixed in 2.4.

  3. gyorgybalazsi

    Ok thanks.