DAR file is corrupt

I am trying to upload a new DAR file via POST /v1/packages request, but I got a 400 response with the message DAR file is corrupted.

I am wondering this might be happening because I had previously updated a package before (and would like to upload a new version).

My questions then are:
why is this happening and how to solve it?
how to delete the previously uploaded package? (restarting the SQL driver did not work)

Can you share the exact error message you are receiving?

{
“errors”: [
“INVALID_ARGUMENT: INVALID_DAR(8,-7455053): Dar file is corrupt”
],
“status”: 400
}

Would it be possible for you to share your DAR file here?

How can I do it?

There is an upload button in the middle above the textbox when you create a post.

Also could you share the code/curl command you’re using to upload the DAR?

It says that is not an authorized format:

Sorry, the file you are trying to upload is not authorized (authorized extensions: jpg, jpeg, png, gif, daml, yaml, mp4, mov, mp3, webp, zip, targz).

I runned it by the daml build command, and trying to upload it via Postman ip/v1/packages, content-type application/octet-stream.

Howdy @h_twist :wave:

Changed the settings so you should be able to upload your .dar now.

Your DAR works fine and I was able to upload it via postman by selecting a binary body. Try the following two steps:

  1. Reproduce against daml sandbox instead of Daml on SQL.
  2. If that still fails, try sending via curl instead of postman. This command should do the trick once you adjust host/ip & token. You need to run it from the directory in which you placed your DAR (or adjust the path to it)
curl -v http://localhost:7575/v1/packages -H "Authorization: Bearer yourtokenhere" --data-binary @logpiper-daml-model-test.dar

Thank, and is there any way to delete the previous uploaded ones?

I would like to make kind of a reset on the ledger.

If you want to reset completely, drop the database for Daml on SQL. That will also drop contracts parties and any other state though. There is no way to just drop packages.

I don’t think that’s your issue though. Previously uploaded packages should never result in this error.

Thank you