# Upgrade is not working on canister

**URL:** <https://forum.dfinity.org/t/upgrade-is-not-working-on-canister/15793>\
**Category:** Developers\
**Tags:** Functional-Programming\
**Created:** [October 7, 2022, 4:18pm UTC](https://forum.dfinity.org/t/upgrade-is-not-working-on-canister/15793 "2022-10-07T16:18:41Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![gladguy](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/gladguy/32/11145_2.png) [@gladguy](https://forum.dfinity.org/u/gladguy)\
**Post date:** [October 7, 2022, 4:18pm UTC](https://forum.dfinity.org/t/upgrade-is-not-working-on-canister/15793/1 "2022-10-07T16:18:41Z")

</div>

Earlier, we were able to change the function, add new function to the canister.  
Now, if i change the function. I am not able to upgrade the canister but only can reinstall the canister which causes complete data loss. Is it a new change in the **dfx 0.11.1**?

**Getting the below error.**  
Error: Failed to install wasm module to canister ‘salesforce\_canister’.  
Caused by: Failed to install wasm module to canister ‘salesforce\_canister’.  
Failed to install wasm in canister ‘xxx-uaaaa-aaaah-xxxx-cai’.  
Failed to install wasm.  
The Replica returned an error: code 5, message: “Canister xxx-uaaaa-aaaah-xxxx-cai trapped explicitly: IDL error: variant or record tag out of order”

Thank you for the reply

---

<div class="post-metadata">

**Author:** ![diegop](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/diegop/32/569_2.png) [@diegop](https://forum.dfinity.org/u/diegop)\
**Post date:** [October 7, 2022, 10:04pm UTC](https://forum.dfinity.org/t/upgrade-is-not-working-on-canister/15793/2 "2022-10-07T22:04:56Z")

</div>

Let me ping someone on the team

---

<div class="post-metadata">

**Author:** ![anon74414410](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@anon74414410](https://forum.dfinity.org/u/anon74414410)\
**Post date:** [October 7, 2022, 10:40pm UTC](https://forum.dfinity.org/t/upgrade-is-not-working-on-canister/15793/3 "2022-10-07T22:40:34Z")

</div>

Would it be possible to provide the `.did` files, before and after?

---

<div class="post-metadata">

**Author:** ![paulyoung](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/paulyoung/32/5251_2.png) [@paulyoung](https://forum.dfinity.org/u/paulyoung)\
**Post date:** [October 9, 2022, 12:44am UTC](https://forum.dfinity.org/t/upgrade-is-not-working-on-canister/15793/4 "2022-10-09T00:44:17Z")

</div>

If you’re using Rust and have manually implemented `CandidType` then it might be the same as [Bug: field id collision or not sorted · Issue #386 · dfinity/candid · GitHub](https://github.com/dfinity/candid/issues/386)

---

<div class="post-metadata">

**Author:** ![gladguy](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/gladguy/32/11145_2.png) [@gladguy](https://forum.dfinity.org/u/gladguy)\
**Post date:** [October 12, 2022, 2:12am UTC](https://forum.dfinity.org/t/upgrade-is-not-working-on-canister/15793/5 "2022-10-12T02:12:19Z")

</div>

Diff says no change Kyle

---

<div class="post-metadata">

**Author:** ![gladguy](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/gladguy/32/11145_2.png) [@gladguy](https://forum.dfinity.org/u/gladguy)\
**Post date:** [October 12, 2022, 2:13am UTC](https://forum.dfinity.org/t/upgrade-is-not-working-on-canister/15793/6 "2022-10-12T02:13:44Z")

</div>

I am using motoko and error is

Caused by: Failed to install wasm module to canister ‘prod\_finance’.  
Failed to install wasm in canister ‘6s6yi-xxxxx-xxxx-qc6iq-cai’.  
Failed to install wasm.  
The Replica returned an error: code 5, message: “Canister 6s6yi-xxxx-xxxx-qc6iq-cai trapped explicitly: IDL error: variant or record tag out of order”

---

<div class="post-metadata">

**Author:** ![marvin](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/marvin/32/9267_2.png) [@marvin](https://forum.dfinity.org/u/marvin)\
**Post date:** [October 19, 2022, 10:12am UTC](https://forum.dfinity.org/t/upgrade-is-not-working-on-canister/15793/7 "2022-10-19T10:12:52Z")

</div>

I’m getting a similar error and I need to roll out a new feature soon does downgrading dfx fix this issue

---

<div class="post-metadata">

**Author:** ![AVOlight](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/avolight/32/3197_2.png) [@AVOlight](https://forum.dfinity.org/u/AVOlight)\
**Post date:** [November 4, 2022, 3:38am UTC](https://forum.dfinity.org/t/upgrade-is-not-working-on-canister/15793/8 "2022-11-04T03:38:28Z")

</div>

any fix for this yet?

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [November 4, 2022, 8:08am UTC](https://forum.dfinity.org/t/upgrade-is-not-working-on-canister/15793/9 "2022-11-04T08:08:36Z")

</div>

Would someone mind sharing an example of this? With candid files, dfx.json, and some canister code? Otherwise debugging this is very difficult

---

<div class="post-metadata">

**Author:** ![gladguy](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/gladguy/32/11145_2.png) [@gladguy](https://forum.dfinity.org/u/gladguy)\
**Post date:** [November 9, 2022, 4:05am UTC](https://forum.dfinity.org/t/upgrade-is-not-working-on-canister/15793/10 "2022-11-09T04:05:20Z")

</div>

Will share the sample code

---

<div class="post-metadata">

**Author:** ![AVOlight](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/avolight/32/3197_2.png) [@AVOlight](https://forum.dfinity.org/u/AVOlight)\
**Post date:** [November 11, 2022, 11:43pm UTC](https://forum.dfinity.org/t/upgrade-is-not-working-on-canister/15793/11 "2022-11-11T23:43:54Z")

</div>

tried stepping through the versions to see where it shows up

DFX\_VERSION=0.9.3; no issue  
DFX\_VERSION=0.10.1; no issue deploying after upgrade but had to use --clean  
DFX\_VERSION=0.11.2; now issue shows up…  
dfx upgrade; 0.12.0 same issue

is there a project specific upgrade call?

---

<div class="post-metadata">

**Author:** ![chenyan](https://avatars.discourse-cdn.com/v4/letter/c/35a633/32.png) [@chenyan](https://forum.dfinity.org/u/chenyan)\
**Post date:** [December 2, 2022, 6:17pm UTC](https://forum.dfinity.org/t/upgrade-is-not-working-on-canister/15793/13 "2022-12-02T18:17:26Z")

</div>

Can you share the .did file before and after? Without it, it’s hard to know what went wrong.
