I having some trouble running the Flipper example from the Ink! webpage.

The cargo contract build outputs the following error log:

ERROR: Loading of original wasm failed

Caused by:
    0: Loading of wasm module at '/Users/winston/workspace/cs/repos/flipper/target/ink/wasm32-unknown-unknown/release/flipper.wasm' failed
    1: Unknown opcode 192

rustup show output:

Default host: aarch64-apple-darwin
rustup home:  /Users/winston/.rustup

installed toolchains

nightly-aarch64-apple-darwin (default)

installed targets for active toolchain


active toolchain

nightly-aarch64-apple-darwin (default)
rustc 1.70.0-nightly (17c116721 2023-03-29)

As you can see, I am running on the M1 OSX system.

  • 1
    Please, remember to mark this question as solved :) Commented Mar 30, 2023 at 17:02
  • Rustc v1.70.0 dont work either so consider sticking with 1.68.0 or 1.69.0 stable Commented Jun 8, 2023 at 11:29
  • I'm running into this in 1.71.1 - what might be the reason?
    – shredding
    Commented Aug 6, 2023 at 9:50

4 Answers 4


Solved! This was caused by the nightly toolchain. Switching to the stable toolchain solved this issue.

Edit: As pointed out by Shunsuke, this is specific to the 1.70.0 nightly build. 1.68.0 version seems to work.

Edit (12th June 2023): If you are using the latest version 3.0.1 of cargo-contract --version then you must fallback to 1.69 (since neither stable or nightly 1.70.0 worked). The CI for cargo-contract has pinned that version, see https://github.com/paritytech/cargo-contract/blob/master/.github/workflows/ci.yml#LL184C62-L184C118

rustup update stable
rustup install 1.69
rustup default 1.69
rustup component add rust-src --toolchain 1.69
rustup target add wasm32-unknown-unknown --toolchain 1.69
cargo contract build
  • 1
    Lots of contracts including OpenBrush PSP22, PSP34 contracts using nightly features such as #![feature(min_specialization)]. This means existing contracts cannot be compiled with nightly toolchain whose rustc version is higher than 1.70.0 (Confirmed 1.68.0 works). cargo contract is now independent from nightly toolchain but it should still support nightly for compatibility.
    – Shunsuke
    Commented Mar 31, 2023 at 7:41
  • 2
    – Shunsuke
    Commented Mar 31, 2023 at 10:19
  • I just had this issue both using 1.70.0 stable & nightly. Fixed by changing back to 1.69 by running rustup update && rustup install 1.69 && rustup default 1.69 && rustup override set 1.69 && rustup component add rust-src --toolchain 1.69 && cargo contract build. Note that cargo-contract has pinned their CI to 1.69 github.com/paritytech/cargo-contract/blob/master/.github/… due to this issue github.com/paritytech/cargo-contract/issues/1139. Commented Jun 11, 2023 at 23:57
  • I was tired to try everything, but this works, even at the end I got this issue info: installing component 'rust-std' for 'wasm32-unknown-unknown' 18.2 MiB / 18.2 MiB (100 %) 17.3 MiB/s in 1s ETA: 0s ERROR: Cannot infer the root project id. Also I aded the rust-toolchain with nightly-2023-02-07" and cargo-contract version cargo-contract v2.2.1 `
    – Cristian
    Commented Aug 28, 2023 at 1:29

For cases where updated nightly is still preferred for whatever reason:

rustup update
rustup install nightly-2023-02-07-aarch64-apple-darwin
rustup component add rust-src --toolchain nightly-2023-02-07-aarch64-apple-darwin

...specify nightly version in tag

cargo +nightly-2023-02-07 contract build

Still running updated nightly rustc 1.70.0 as default: image


Adding a rust toolchain override file can also work.

Such as this:

channel = "nightly-2023-01-01"
components = [ "rustfmt" ]
targets = [ "wasm32-unknown-unknown" ]
profile = "minimal"

ran into the same issue using v3.0 cargo contract , updating cargo contract to v4 solved it. Use

cargo install --git https://github.com/paritytech/cargo-contract cargo-contract --force

to update

  • you can also leave your rustc version as is... no need to downgrade
    – Honour
    Commented Aug 2, 2023 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.