Failed to install wasm module to canister in dfx 0.12.1

Can anyone help me fix this?

dfx canister install --all
Installing code for canister dbank, with canister ID rrkah-fqaaa-aaaaa-aaaaq-cai
Error: Failed to install wasm module to canister ‘dbank’.
Caused by: Failed to install wasm module to canister ‘dbank’.
Failed to install wasm in canister ‘rrkah-fqaaa-aaaaa-aaaaq-cai’.
Failed to install wasm.
The Replica returned an error: code 5, message: “Canister rrkah-fqaaa-aaaaa-aaaaq-cai cannot be installed because the canister is not empty. Try installing with mode=‘reinstall’ instead.”

The error message contains all info you need: “Canister rrkah-fqaaa-aaaaa-aaaaq-cai cannot be installed because the canister is not empty. Try installing with mode=‘reinstall’ instead.”

The IC is very specific in how it accepts code to be installed in order to prevent mistakes. Now it assumed that you trying to use --mode install (the default one) means that you made a mistake since you already installed code earlier.

Possible source of the error: You forgot to run dfx start with --clean. I make that mistake at least daily myself…

2 Likes

Thanks! But I somehow fixed that by downgrading dfx to 0.9.3 from dfx 0.12.1. Dfinity community is amazing. :ok_hand:t2:

I’m getting below error while running given piece of code in ubuntu terminal.

open http://localhost:8000/?canisterId=id: bd3sg-teaaa-aaaaa-qaaba-cai
Warning: unknown mime-type for "http://localhost:8000/?canisterId=id:" -- using "application/octet-stream"
Warning: unknown mime-type for "bd3sg-teaaa-aaaaa-qaaba-cai" -- using "application/octet-stream"
Error: no such file "http://localhost:8000/?canisterId=id:"
Error: no such file "bd3sg-teaaa-aaaaa-qaaba-cai"

also if possible check my question on stack StackQ

dfx start --clean worked for me thanks :slight_smile: