FAILED_PRECONDITION: DAML_INTERPRETATION_ERROR(9,32464f18): Interpretation error: Error: Unhandled Daml exception: DA.Exception.PreconditionFailed:PreconditionFailed@f20de1e4

I am getting this error while creating an asset . The template I amusing is Asset.daml which is present in wallet app directory.
I have uploaded the .dar file of Asset , I am trying to create an asset directly from hub
Attaching some screenshots for reference

Please let me know how can we achieve this on hub without UI.


If you look at the source code, the Asset template contains the following ensure clause

ensure (if assetType.fungible then amount>0.0 else (amount==1.0))

This specifies that for non-fungible asset the amount must be equal to 1.0. An attempt to create a non-fungible asset with amount other than 1.0 will fail and raise a PreconditionFailed exception.

To elaborate onn @a_putkov’s answer: PreconditionFailed is always a failure in an ensure clause.

Thanks @a_putkov @cocreature . I was selecting fungible option as false . so it was throwing the error.