# DAR file is corrupt

**URL:** <https://forum.canton.network/t/dar-file-is-corrupt/3800>\
**Category:** App Development\
**Tags:** daml, ledger-api\
**Created:** [January 27, 2022, 12:17pm UTC](https://forum.canton.network/t/dar-file-is-corrupt/3800 "2022-01-27T12:17:31Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![h\_twist](https://avatars.discourse-cdn.com/v4/letter/h/85e7bf/32.png) [@h\_twist](https://forum.canton.network/u/h_twist)\
**Post date:** [January 27, 2022, 12:17pm UTC](https://forum.canton.network/t/dar-file-is-corrupt/3800/1 "2022-01-27T12:17:31Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [January 27, 2022, 12:18pm UTC](https://forum.canton.network/t/dar-file-is-corrupt/3800/2 "2022-01-27T12:18:24Z")

</div>

Can you share the exact error message you are receiving?

---

<div class="post-metadata">

**Author:** ![h\_twist](https://avatars.discourse-cdn.com/v4/letter/h/85e7bf/32.png) [@h\_twist](https://forum.canton.network/u/h_twist)\
**Post date:** [January 27, 2022, 12:23pm UTC](https://forum.canton.network/t/dar-file-is-corrupt/3800/3 "2022-01-27T12:23:24Z")

</div>

{  
“errors”: [  
“INVALID\_ARGUMENT: INVALID\_DAR(8,-7455053): Dar file is corrupt”  
],  
“status”: 400  
}

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [January 27, 2022, 12:23pm UTC](https://forum.canton.network/t/dar-file-is-corrupt/3800/4 "2022-01-27T12:23:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![h\_twist](https://avatars.discourse-cdn.com/v4/letter/h/85e7bf/32.png) [@h\_twist](https://forum.canton.network/u/h_twist)\
**Post date:** [January 27, 2022, 12:27pm UTC](https://forum.canton.network/t/dar-file-is-corrupt/3800/5 "2022-01-27T12:27:02Z")

</div>

How can I do it?

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [January 27, 2022, 12:28pm UTC](https://forum.canton.network/t/dar-file-is-corrupt/3800/6 "2022-01-27T12:28:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [January 27, 2022, 12:29pm UTC](https://forum.canton.network/t/dar-file-is-corrupt/3800/7 "2022-01-27T12:29:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![h\_twist](https://avatars.discourse-cdn.com/v4/letter/h/85e7bf/32.png) [@h\_twist](https://forum.canton.network/u/h_twist)\
**Post date:** [January 27, 2022, 12:35pm UTC](https://forum.canton.network/t/dar-file-is-corrupt/3800/8 "2022-01-27T12:35:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nemanja](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/nemanja/32/842_2.png) [@nemanja](https://forum.canton.network/u/nemanja)\
**Post date:** [January 27, 2022, 12:55pm UTC](https://forum.canton.network/t/dar-file-is-corrupt/3800/9 "2022-01-27T12:55:02Z")

</div>

Howdy @h_twist 👋

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

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [January 27, 2022, 1:13pm UTC](https://forum.canton.network/t/dar-file-is-corrupt/3800/11 "2022-01-27T13:13:09Z")

</div>

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)

```haskell
curl -v http://localhost:7575/v1/packages -H "Authorization: Bearer yourtokenhere" --data-binary @logpiper-daml-model-test.dar

```

---

<div class="post-metadata">

**Author:** ![h\_twist](https://avatars.discourse-cdn.com/v4/letter/h/85e7bf/32.png) [@h\_twist](https://forum.canton.network/u/h_twist)\
**Post date:** [January 27, 2022, 1:19pm UTC](https://forum.canton.network/t/dar-file-is-corrupt/3800/12 "2022-01-27T13:19:59Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [January 27, 2022, 1:20pm UTC](https://forum.canton.network/t/dar-file-is-corrupt/3800/13 "2022-01-27T13:20:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![h\_twist](https://avatars.discourse-cdn.com/v4/letter/h/85e7bf/32.png) [@h\_twist](https://forum.canton.network/u/h_twist)\
**Post date:** [January 27, 2022, 1:25pm UTC](https://forum.canton.network/t/dar-file-is-corrupt/3800/14 "2022-01-27T13:25:29Z")

</div>

Thank you
