Ledger.streamQueries errors {errors: Array(1), status: 400}errors: ["Cannot not resolve any template ID from request"]

Hi, when I am trying to access the canton-ledger from React UX, I get following error -

index.js:526 Ledger.streamQueries warnings 
* {warnings: {…}}
1. warnings:
  1. unknownTemplateIds: Array(1)
    1. 0: "90e9260ca0d6b4a3ddca895ffc285b9e66ebdd2e8bbe89215ed45ce8278c7963:MSFT.Daphne.Roles.StandardRegistry:StandardRegistryRole"
   
index.js:529 Ledger.streamQueries errors {errors: Array(1), status: 400}errors: ["Cannot not resolve any template ID from request"]status: 400__proto__: Object
x @ index.js:529

I tried re-building the DAML project and redeploy it to the canton participants. But still the same error.

Please help us understand this and fix this.

Thanks

1 Like

This error arises when the DAR you ran daml codegen js against is not known to the JSON API which in turn gets the list of packages from the participant and refreshes it automatically.

There are two common causes:

  1. The DAR did not get uploaded to the participant. Sounds like you checked that, so that shouldn’t be it.
  2. The generated JS code refers to an older version of a DAR. E.g., let’s say you build a DAR, run daml codegen js and then modify your Daml code and rebuild the DAR and upload that second DAR to the ledger. Your JS code will still refer to the old DAR which has not been uploaded to the ledger. In that case, make sure that you are regenerating your JS code whenever you rebuild your DAR.

You can get a list of packages known to the JSON API which might be useful for debugging by querying /v1/packages.

1 Like

Hi, I have double checked the DAR referred in JS and the one’s uploaded to the participant. Both have same hash - 90e9260ca0d6b4a3ddca895ffc285b9e66ebdd2e8bbe89215ed45ce8278c7963.

But still I get this error.

To verify the dar uploaded to participant, I have downloaded it using “participant.dars.download” api.

1 Like

Can you check the list of packages the JSON API shows you via /v1/packages? It should agree with the participant but maybe there is an issue somewhere.

1 Like

Hi I have verified the packages listing from JSON API via /v1/packages and also from participant via participant.packages.list.

Both show similar list -

Response of JSON API - /v1/packages

1. "f3a8894cb1c3e35049399d6a7ae98b6669772e31c932afff68e1b3ac36b8f327",
2. "c1f1f00558799eec139fb4f4c76f95fb52fa1837a5dd29600baa1c8ed1bdccfd",
3. "733e38d36a2759688a4b2c4cec69d48e7b55ecc8dedc8067b815926c917a182a",
4. "bfcd37bd6b84768e86e432f5f6c33e25d9e7724a9d42e33875ff74f6348e733f",
5. "11bf0924efc486bc7c6546439c00b74bf2fe3689453799eb320897781622ec13",
6. "518032f41fd0175461b35ae0c9691e08b4aea55e62915f8360af2cc7a1f2ba6c",
7. "8b58230a4b874368eee876d992bd8a4eee1bd9404d48e46fc5f7251aa38b68f9",
8. "cc348d369011362a5190fe96dd1f0dfbc697fdfd10e382b9e9666f0da05961b7",
9. "45bf6226704de835c3c7bcde0f82a99cddf0854dd1ed73ba575ad084902d62cd",
10. "d8c2ae4afe16f0192cfcaa00ee16e0cf68c22020aa81e1ad55f739f5c42516fd",
11. "6839a6d3d430c569b2425e9391717b44ca324b88ba621d597778811b2d05031d",
12. "99a2705ed38c1c26cbb8fe7acf36bbf626668e167a33335de932599219e0a235",
13. "76bf0fd12bd945762a01f8fc5bbcdfa4d0ff20f8762af490f8f41d6237c6524f",
14. "e22bce619ae24ca3b8e6519281cb5a33b64b3190cc763248b4c3f9ad5087a92c",
15. "d58cf9939847921b2aab78eaa7b427dc4c649d25e6bee3c749ace4c3f52f5c97",
16. "2f9818c944cfa2a33e8cdea9bc2ea085de4f3b24f6599a628dd2cfef81da8dbf",
17. "6c2c0667393c5f92f1885163068cd31800d2264eb088eb6fc740e11241b2bf06",
18. "d14e08374fc7197d6a0de468c968ae8ba3aadbf9315476fd39071831f5923662",
19. "057eed1fd48c238491b8ea06b9b5bf85a5d4c9275dd3f6183e0e6b01730cc2ba",
20. "e491352788e56ca4603acc411ffe1a49fefd76ed8b163af86cf5ee5f4c38645b",
21. "40f452260bef3f29dede136108fc08a88d5a5250310281067087da6f0baddff7",
22. "97b883cd8a2b7f49f90d5d39c981cf6e110cf1f1c64427a28a6d58ec88c43657",
23. "90e9260ca0d6b4a3ddca895ffc285b9e66ebdd2e8bbe89215ed45ce8278c7963",
24. "8a7806365bbd98d88b4c13832ebfa305f6abaeaf32cfa2b7dd25c4fa489b79fb"

Response of Participant.packages.list

PackageId - 2f9818c944cfa2a33e8cdea9bc2ea085de4f3b24f6599a628dd2cfef81da8dbf + Source Description - dar/AdminWorkflows.dar
PackageId - cc348d369011362a5190fe96dd1f0dfbc697fdfd10e382b9e9666f0da05961b7 + Source Description - project-daphne
PackageId - e491352788e56ca4603acc411ffe1a49fefd76ed8b163af86cf5ee5f4c38645b + Source Description - project-daphne
PackageId - f3a8894cb1c3e35049399d6a7ae98b6669772e31c932afff68e1b3ac36b8f327 + Source Description - project-daphne
PackageId - 99a2705ed38c1c26cbb8fe7acf36bbf626668e167a33335de932599219e0a235 + Source Description - project-daphne
PackageId - 8a7806365bbd98d88b4c13832ebfa305f6abaeaf32cfa2b7dd25c4fa489b79fb + Source Description - project-daphne
PackageId - bfcd37bd6b84768e86e432f5f6c33e25d9e7724a9d42e33875ff74f6348e733f + Source Description - project-daphne
PackageId - 11bf0924efc486bc7c6546439c00b74bf2fe3689453799eb320897781622ec13 + Source Description - dar/AdminWorkflows.dar
PackageId - 733e38d36a2759688a4b2c4cec69d48e7b55ecc8dedc8067b815926c917a182a + Source Description - project-daphne
PackageId - 6839a6d3d430c569b2425e9391717b44ca324b88ba621d597778811b2d05031d + Source Description - project-daphne
PackageId - 45bf6226704de835c3c7bcde0f82a99cddf0854dd1ed73ba575ad084902d62cd + Source Description - dar/AdminWorkflows.dar
PackageId - 057eed1fd48c238491b8ea06b9b5bf85a5d4c9275dd3f6183e0e6b01730cc2ba + Source Description - project-daphne
PackageId - e22bce619ae24ca3b8e6519281cb5a33b64b3190cc763248b4c3f9ad5087a92c + Source Description - project-daphne
PackageId - 518032f41fd0175461b35ae0c9691e08b4aea55e62915f8360af2cc7a1f2ba6c + Source Description - project-daphne
PackageId - c1f1f00558799eec139fb4f4c76f95fb52fa1837a5dd29600baa1c8ed1bdccfd + Source Description - project-daphne
PackageId - d8c2ae4afe16f0192cfcaa00ee16e0cf68c22020aa81e1ad55f739f5c42516fd + Source Description - project-daphne
PackageId - 76bf0fd12bd945762a01f8fc5bbcdfa4d0ff20f8762af490f8f41d6237c6524f + Source Description - project-daphne
PackageId - d14e08374fc7197d6a0de468c968ae8ba3aadbf9315476fd39071831f5923662 + Source Description - project-daphne
PackageId - 8b58230a4b874368eee876d992bd8a4eee1bd9404d48e46fc5f7251aa38b68f9 + Source Description - project-daphne
PackageId - d58cf9939847921b2aab78eaa7b427dc4c649d25e6bee3c749ace4c3f52f5c97 + Source Description - project-daphne
PackageId - 97b883cd8a2b7f49f90d5d39c981cf6e110cf1f1c64427a28a6d58ec88c43657 + Source Description - project-daphne
PackageId - 40f452260bef3f29dede136108fc08a88d5a5250310281067087da6f0baddff7 + Source Description - project-daphne
PackageId - 90e9260ca0d6b4a3ddca895ffc285b9e66ebdd2e8bbe89215ed45ce8278c7963 + Source Description - project-daphne
PackageId - 6c2c0667393c5f92f1885163068cd31800d2264eb088eb6fc740e11241b2bf06 + Source Description - project-daphne
1 Like

This is the exact error I am getting.

Can you please help me understand what could have gone wrong and resolve this.

1 Like

Are you using yarn and referencing that package via a file: dependency? in that case you need to run yarn install --force to make it pick up changes to the generated code.

1 Like

Yes, we are using yarn and also running the same command as suggested -

yarn install --force --frozen-lockfile

1 Like

I recommend going the

rm -rf node_modules && rm yarn.lock

route. I don’t see anything off so broken caching seems like the most likely option.

1 Like

I removed all build files and node_modules. And even tried a fresh deployment on different machine. Still the same error.

Weird, not quite sure what is going wrong there. Can you reproduce the same error when you deploy the project to Sandbox instead of Canton?

It would also be very great if you could share the log output of the JSON API, I’m particularly interested in lines like the following but anything you can share is useful

06:50:33.043 [http-json-ledger-api-akka.actor.default-dispatcher-4] INFO  com.daml.http.PackageService - new package IDs loaded: f3a8894cb1c3e35049399d6a7ae98b6669772e31c932afff68e1b3ac36b8f327, c1f1f00558799eec139fb4f4c76f95fb52fa1837a5dd29600baa1c8ed1bdccfd, 733e38d36a2759688a4b2c4cec69d48e7b55ecc8dedc8067b815926c917a182a, bfcd37bd6b84768e86e432f5f6c33e25d9e7724a9d42e33875ff74f6348e733f, 518032f41fd0175461b35ae0c9691e08b4aea55e62915f8360af2cc7a1f2ba6c, 8b58230a4b874368eee876d992bd8a4eee1bd9404d48e46fc5f7251aa38b68f9, cc348d369011362a5190fe96dd1f0dfbc697fdfd10e382b9e9666f0da05961b7, 0e53cf68e452f8c59f04d08031128f3720a971dbfd685abda7cc305a67478f14, d8c2ae4afe16f0192cfcaa00ee16e0cf68c22020aa81e1ad55f739f5c42516fd, 6839a6d3d430c569b2425e9391717b44ca324b88ba621d597778811b2d05031d, 99a2705ed38c1c26cbb8fe7acf36bbf626668e167a33335de932599219e0a235, 76bf0fd12bd945762a01f8fc5bbcdfa4d0ff20f8762af490f8f41d6237c6524f, e22bce619ae24ca3b8e6519281cb5a33b64b3190cc763248b4c3f9ad5087a92c, d58cf9939847921b2aab78eaa7b427dc4c649d25e6bee3c749ace4c3f52f5c97, 6c2c0667393c5f92f1885163068cd31800d2264eb088eb6fc740e11241b2bf06, d14e08374fc7197d6a0de468c968ae8ba3aadbf9315476fd39071831f5923662, 057eed1fd48c238491b8ea06b9b5bf85a5d4c9275dd3f6183e0e6b01730cc2ba, e491352788e56ca4603acc411ffe1a49fefd76ed8b163af86cf5ee5f4c38645b, 40f452260bef3f29dede136108fc08a88d5a5250310281067087da6f0baddff7, 97b883cd8a2b7f49f90d5d39c981cf6e110cf1f1c64427a28a6d58ec88c43657, 8a7806365bbd98d88b4c13832ebfa305f6abaeaf32cfa2b7dd25c4fa489b79fb

– Logs begin at Thu 2021-04-08 05:52:37 UTC, end at Thu 2021-04-08 06:59:39 UTC. –
Apr 08 06:43:43 daphne5-participant2 systemd[1]: Started DAML JSON-API.
Apr 08 06:43:50 daphne5-participant2 json-api.sh[18958]: 06:43:50.361 [main] INFO com.daml.http.Main$ - Config(ledgerHost=localhost, ledgerPort=14021, address=127.0.0.1, httpPort=9000, portFile=None, packageReloadInterval=5 seconds, packageMaxInboundMessageSize=None, maxInboundMessageSize=4194304, tlsConfig=TlsConfiguration(false,None,None,None,REQUIRE,false,List()), jdbcConfig=None, staticContentConfig=None, allowNonHttps=false, accessTokenFile=None, wsConfig=None)
Apr 08 06:43:51 daphne5-participant2 json-api.sh[18958]: 06:43:51.266 [http-json-ledger-api-akka.actor.default-dispatcher-6] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
Apr 08 06:43:53 daphne5-participant2 json-api.sh[18958]: 06:43:53.929 [http-json-ledger-api-akka.actor.default-dispatcher-7] ERROR com.daml.http.Main$ - Cannot start server: Error(Cannot connect to the ledger server, error: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: 06:43:54.114 [shutdownHook2] INFO com.daml.http.HttpService$ - Stopping server…
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: 06:43:54.142 [http-json-ledger-api-akka.actor.default-dispatcher-8] ERROR com.daml.http.Main$ - Shutdown error
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: java.util.NoSuchElementException: Future.collect partial function is not defined at: -/(Error(Cannot connect to the ledger server, error: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception))
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at scala.concurrent.Future.$anonfun$collect$2(Future.scala:374)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at com.daml.http.HttpService$$anonfun$stop$1.applyOrElse(HttpService.scala:269)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at scala.concurrent.Future.$anonfun$collect$1(Future.scala:374)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at scala.util.Success.$anonfun$map$1(Try.scala:255)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at scala.util.Success.map(Try.scala:213)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at scala.concurrent.Future.$anonfun$map$1(Future.scala:292)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:56)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:93)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:85)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:93)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:48)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: daml-helper: Received ExitFailure 101 when running
Apr 08 06:43:54 daphne5-participant2 json-api.sh[18958]: Raw command: java -Dlogback.configurationFile=/home/canton-admin/.daml/sdk/1.11.1/daml-sdk/json-api-logback.xml -jar /home/canton-admin/.daml/sdk/1.11.1/daml-sdk/daml-sdk.jar json-api --ledger-host localhost --ledger-port 14021 --address 127.0.0.1 --http-port 9000
Apr 08 06:43:54 daphne5-participant2 systemd[1]: json-api.service: Main process exited, code=exited, status=123/n/a
Apr 08 06:43:54 daphne5-participant2 systemd[1]: json-api.service: Failed with result ‘exit-code’.
Apr 08 06:43:54 daphne5-participant2 systemd[1]: json-api.service: Service hold-off time over, scheduling restart.
Apr 08 06:43:54 daphne5-participant2 systemd[1]: json-api.service: Scheduled restart job, restart counter is at 1.
Apr 08 06:43:54 daphne5-participant2 systemd[1]: Stopped DAML JSON-API.
Apr 08 06:43:54 daphne5-participant2 systemd[1]: Started DAML JSON-API.
Apr 08 06:44:01 daphne5-participant2 json-api.sh[19156]: 06:44:01.381 [main] INFO com.daml.http.Main$ - Config(ledgerHost=localhost, ledgerPort=14021, address=127.0.0.1, httpPort=9000, portFile=None, packageReloadInterval=5 seconds, packageMaxInboundMessageSize=None, maxInboundMessageSize=4194304, tlsConfig=TlsConfiguration(false,None,None,None,REQUIRE,false,List()), jdbcConfig=None, staticContentConfig=None, allowNonHttps=false, accessTokenFile=None, wsConfig=None)
Apr 08 06:44:02 daphne5-participant2 json-api.sh[19156]: 06:44:02.486 [http-json-ledger-api-akka.actor.default-dispatcher-6] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
Apr 08 06:44:06 daphne5-participant2 json-api.sh[19156]: 06:44:06.687 [http-json-ledger-api-akka.actor.default-dispatcher-7] INFO com.daml.http.HttpService$ - Connected to Ledger: projectOwner
Apr 08 06:44:06 daphne5-participant2 json-api.sh[19156]: 06:44:06.690 [http-json-ledger-api-akka.actor.default-dispatcher-7] INFO com.daml.http.HttpService$ - contractDao: None
Apr 08 06:44:09 daphne5-participant2 json-api.sh[19156]: 06:44:09.430 [http-json-ledger-api-akka.actor.default-dispatcher-7] INFO com.daml.http.PackageService - new package IDs loaded: c1f1f00558799eec139fb4f4c76f95fb52fa1837a5dd29600baa1c8ed1bdccfd, 733e38d36a2759688a4b2c4cec69d48e7b55ecc8dedc8067b815926c917a182a, bfcd37bd6b84768e86e432f5f6c33e25d9e7724a9d42e33875ff74f6348e733f, 11bf0924efc486bc7c6546439c00b74bf2fe3689453799eb320897781622ec13, 518032f41fd0175461b35ae0c9691e08b4aea55e62915f8360af2cc7a1f2ba6c, cc348d369011362a5190fe96dd1f0dfbc697fdfd10e382b9e9666f0da05961b7, 45bf6226704de835c3c7bcde0f82a99cddf0854dd1ed73ba575ad084902d62cd, 6839a6d3d430c569b2425e9391717b44ca324b88ba621d597778811b2d05031d, 99a2705ed38c1c26cbb8fe7acf36bbf626668e167a33335de932599219e0a235, 76bf0fd12bd945762a01f8fc5bbcdfa4d0ff20f8762af490f8f41d6237c6524f, e22bce619ae24ca3b8e6519281cb5a33b64b3190cc763248b4c3f9ad5087a92c, d58cf9939847921b2aab78eaa7b427dc4c649d25e6bee3c749ace4c3f52f5c97, 2f9818c944cfa2a33e8cdea9bc2ea085de4f3b24f6599a628dd2cfef81da8dbf, 6c2c0667393c5f92f1885163068cd31800d2264eb088eb6fc740e11241b2bf06, d14e08374fc7197d6a0de468c968ae8ba3aadbf9315476fd39071831f5923662, 057eed1fd48c238491b8ea06b9b5bf85a5d4c9275dd3f6183e0e6b01730cc2ba, e491352788e56ca4603acc411ffe1a49fefd76ed8b163af86cf5ee5f4c38645b, 40f452260bef3f29dede136108fc08a88d5a5250310281067087da6f0baddff7, 8a7806365bbd98d88b4c13832ebfa305f6abaeaf32cfa2b7dd25c4fa489b79fb
Apr 08 06:44:10 daphne5-participant2 json-api.sh[19156]: 06:44:10.929 [http-json-ledger-api-akka.actor.default-dispatcher-7] INFO com.daml.http.Main$ - Started server: ServerBinding(/127.0.0.1:9000)
Apr 08 06:58:19 daphne5-participant2 json-api.sh[19156]: 06:58:19.875 [http-json-ledger-api-akka.actor.default-dispatcher-11] INFO com.daml.http.PackageService - new package IDs loaded: f3a8894cb1c3e35049399d6a7ae98b6669772e31c932afff68e1b3ac36b8f327, 8b58230a4b874368eee876d992bd8a4eee1bd9404d48e46fc5f7251aa38b68f9, d8c2ae4afe16f0192cfcaa00ee16e0cf68c22020aa81e1ad55f739f5c42516fd, 97b883cd8a2b7f49f90d5d39c981cf6e110cf1f1c64427a28a6d58ec88c43657, 90e9260ca0d6b4a3ddca895ffc285b9e66ebdd2e8bbe89215ed45ce8278c7963

Are you starting the JSON API after the package has already been uploaded? The package id does not appear in the list here which it definitely should if you do that.

If you start the JSON API before (which should definitely work), it refreshes packages every 5 seconds by default. Did you modify --package-reload-interval by any chance to reduce that to something higher?

These are the latest logs and from old logs, I have seen that daml version on participants is old (1.2.1) and after upgrading to latest 1.11.1, it started working.

Thanks a lot @cocreature for the help.

Glad you figured it out!