Upgrade is not working on canister

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

Let me ping someone on the team

1 Like

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

1 Like

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

1 Like

Diff says no change Kyle

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”

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

1 Like

any fix for this yet?

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

4 Likes

Will share the sample code

2 Likes

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?

Could any team/project experiencing this with their backend in Motoko, share their code either via git or snapshot sections.

Our team is facing the same issue and we’d like to compare approaches to scaling and how they may differ from the currently available examples.

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