When I compile a specific INK! 4.0 smart contract i get the following error: ERROR: Error invoking `cargo metadata

I have multiple INK! 4.0 smart contracts that are compiling successfully without the above error, i even copy and pasted the Cargo.toml file of the working contracts but Im still getting the above error.

Here's how my Cargo.toml file looks like:

Link - https://ibb.co/wdN3FTp

Thanks in advance.

  • I don't know what's the reason but this specific error can be omit by using # ink = { version = "4.0.0-beta", default-features = false } instead ink = { version = "https://github.com/paritytech/ink", commit = "4655a8b4413cb50cbc38d1b7c173ad426ab06cde", default-features = false }
    – Ganesh11
    Dec 27, 2022 at 2:07
  • instead of branch in openbrush dependency you can use tag="3.0.0-beta", also scale dependency should be 2.3, and try to remove target and Cargo.lock, clean build the contract
    – kriko727
    Dec 27, 2022 at 14:08

1 Answer 1


If you are using latest ink i.e. 4.0.0-beta and latest openbrush, then you have to change little bit in Cargo.toml file.

  1. use this for ink package: ink = { git = "https://github.com/paritytech/ink", rev = "4655a8b4413cb50cbc38d1b7c173ad426ab06cde", default-features = false }

  2. use version = "2.3" for scale_info: scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }

  3. for openbrush use tag instead version: openbrush = { tag = "3.0.0-beta", git = "https://github.com/727-Ventures/openbrush-contracts", default-features = false, features = ["psp34"] }

Your Answer

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

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