Error when trying to run Daml Script against Daml Hub

I know there was a bug in Daml 2.3 but this should be something different because I’m using Daml 2.2. (I know that Daml 2.4 is already out which fixes the bug.)

I do everything as per the docs, still get this error:

Exception in thread "main" java.lang.IllegalArgumentException: Invalid host or port: https://he9859csro7wckhs.daml.app 443

The participants.json file contains the base data correctly:

   "default_participant": {
        "host": "https://he9859csro7wckhs.daml.app",
        "port": 443,

Am I doing something wrong?

Can you share the full error including stack trace and the full version number (e.g. 2.2.0)?

Sure, sdk-version: 2.2.0, the full error log:

Exception in thread "main" java.lang.IllegalArgumentException: Invalid host or port: https://he9859csro7wckhs.daml.app 443
	at io.grpc.internal.GrpcUtil.authorityFromHostAndPort(GrpcUtil.java:529)
	at io.grpc.netty.NettyChannelBuilder.forAddress(NettyChannelBuilder.java:151)
	at com.daml.ledger.client.configuration.LedgerClientChannelConfiguration.builderFor(LedgerClientChannelConfiguration.scala:21)
	at com.daml.ledger.client.LedgerClient$.singleHost(LedgerClient.scala:131)
	at com.daml.lf.engine.script.Runner$.connectApiParameters(Runner.scala:255)
	at com.daml.lf.engine.script.Runner$.$anonfun$connect$1(Runner.scala:269)
	at scalaz.std.OptionInstances$$anon$2.$anonfun$traverseImpl$1(Option.scala:26)
	at scala.Option.map(Option.scala:242)
	at scalaz.std.OptionInstances$$anon$2.traverseImpl(Option.scala:26)
	at scalaz.std.OptionInstances$$anon$2.traverseImpl(Option.scala:12)
	at scalaz.Traverse$Traversal.run(Traverse.scala:50)
	at scalaz.Traverse.traverse(Traverse.scala:62)
	at scalaz.Traverse.traverse$(Traverse.scala:61)
	at scalaz.std.OptionInstances$$anon$2.traverse(Option.scala:12)
	at scalaz.Applicative.traverse(Applicative.scala:37)
	at scalaz.Applicative.traverse$(Applicative.scala:36)
	at scalaz.std.FutureInstance.traverse(Future.scala:17)
	at scalaz.syntax.TraverseOps.traverse(TraverseSyntax.scala:14)
	at com.daml.lf.engine.script.Runner$.connect(Runner.scala:268)
	at com.daml.lf.engine.script.RunnerMain$.main(RunnerMain.scala:96)
	at com.daml.lf.engine.script.ScriptMain$.main(ScriptMain.scala:19)
	at com.daml.sdk.SdkMain$.main(SdkMain.scala:21)
	at com.daml.sdk.SdkMain.main(SdkMain.scala)
Caused by: java.net.URISyntaxException: Expected closing bracket for IPv6 address at index 9: //[https://he9859csro7wckhs.daml.app]:443
	at java.base/java.net.URI$Parser.fail(URI.java:2913)
	at java.base/java.net.URI$Parser.failExpecting(URI.java:2919)
	at java.base/java.net.URI$Parser.parseServer(URI.java:3292)
	at java.base/java.net.URI$Parser.parseAuthority(URI.java:3216)
	at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3158)
	at java.base/java.net.URI$Parser.parse(URI.java:3125)
	at java.base/java.net.URI.<init>(URI.java:685)
	at io.grpc.internal.GrpcUtil.authorityFromHostAndPort(GrpcUtil.java:527)
	... 22 more

Based on that it looks like you’re using JSON API parameters (in particular an HTTPS URL) rather but you have not passed --json-api to Daml Script. Either switch to the gRPC API (at least drop the https://, don’t remember if hub has different hosts and ports for that) or pass --json-api.

2 Likes

Passing this flag solves the problem, thank you!

2 Likes