Skip to content
Discussions/App Development/DAR file is corruptForum ↗

DAR file is corrupt

App Development13 posts466 viewsLast activity Jan 2022
H_
h_twistOP
Jan 2022

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)

CO
cocreature
Jan 2022

Can you share the exact error message you are receiving?

H_
h_twist
Jan 2022

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

CO
cocreature
Jan 2022

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

H_
h_twist
Jan 2022

How can I do it?

CO
cocreature
Jan 2022

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

CO
cocreature
Jan 2022

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

H_
h_twist
Jan 2022

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.

NE
nemanja
Jan 2022

Howdy @h_twist :wave:

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

CO
cocreature
Jan 2022

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
H_
h_twist
Jan 2022

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

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

CO
cocreature
Jan 2022

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.

H_
h_twist
Jan 2022

Thank you

← Back to Discussions