Why an Unexpected NoSuchElementException Exception? key not found: UNRECOGNIZED?

When trying to upload a DAR to a participant node, I am receiving the exception:

Unexpected NoSuchElementException Exception
     :
key not found: UNRECOGNIZED
Full exception details
2025-06-06 13:06:05,864 [canton-env-ec-81] ERROR com.digitalasset.daml.lf - LF internal error in com.digitalasset.daml.lf.archive.DecodeV2.decodePackage: Unexpected NoSuchElementException Exception
2025-06-06 13:06:05,864 [canton-env-ec-81] ERROR com.digitalasset.daml.lf - root cause
java.util.NoSuchElementException: key not found: UNRECOGNIZED
	at scala.collection.immutable.BitmapIndexedMapNode.apply(HashMap.scala:674)
	at scala.collection.immutable.HashMap.apply(HashMap.scala:132)
	at com.digitalasset.daml.lf.archive.DecodeV2$Env.uncheckedDecodeType(DecodeV2.scala:715)
	at com.digitalasset.daml.lf.archive.DecodeV2$Env.uncheckedDecodeTypeForTest(DecodeV2.scala:221)
	at com.digitalasset.daml.lf.archive.DecodeV2.$anonfun$decodeInternedTypes$1(DecodeV2.scala:171)
	at scala.collection.IterableOnceOps.foldLeft(IterableOnce.scala:727)
	at scala.collection.IterableOnceOps.foldLeft$(IterableOnce.scala:721)
	at scala.collection.AbstractIterator.foldLeft(Iterator.scala:1303)
	at com.digitalasset.daml.lf.archive.DecodeV2.decodeInternedTypes(DecodeV2.scala:170)
	at com.digitalasset.daml.lf.archive.DecodeV2.$anonfun$decodePackage$2(DecodeV2.scala:62)
	at com.digitalasset.daml.lf.archive.package$.attempt(package.scala:32)
	at com.digitalasset.daml.lf.archive.DecodeV2.decodePackage(DecodeV2.scala:34)
	at com.digitalasset.daml.lf.archive.Decode$.decodeArchivePayload(Decode.scala:24)
	at com.digitalasset.daml.lf.archive.Decode$.$anonfun$decodeArchive$1(Decode.scala:52)
	at scala.util.Either.flatMap(Either.scala:360)
	at com.digitalasset.daml.lf.archive.Decode$.decodeArchive(Decode.scala:52)
	at com.digitalasset.canton.participant.admin.PackageUploader.$anonfun$upload$9(PackageUploader.scala:116)
	at cats.data.EitherT.$anonfun$flatMap$1(EitherT.scala:446)
	at com.digitalasset.canton.lifecycle.FutureUnlessShutdownImpl$$anon$4.$anonfun$flatMap$1(FutureUnlessShutdown.scala:266)
	at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:470)
	at com.daml.executors.QueueAwareExecutorService$TrackingRunnable.run(QueueAwareExecutorService.scala:98)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

Why?

This can be caused when there is an incompatibility between the compilation of the DAR and the Canton participant version.

  • Use Daml SDK version for a given DAR? to check the SDK version used to compile the DAR.

  • Use curl -s http://localhost:7575/v2/version | jq .version to query the participant version.