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…