If you get this error in Hardhat: ``` Transaction reverted: function call to a non-contract account ``` It means that your transaction is (at some point) making a call to an address that is not a contract. There are two common scenarios where this happen. ## Wrong argument A simple example of how this could happen is if you have these two contracts: ```solidity contract Foo { function f() public {} } contract FooCaller { function callFoo(Foo foo) public { foo.f(); } } ``` And you execute this code: ```js const [signer] = await ethers.getSigners(); const Foo = await ethers.getContractFactory("Foo"); const foo = await Foo.deploy(); await foo.deployed(); const FooCaller = await ethers.getContractFactory("FooCaller"); const fooCaller = await FooCaller.deploy(); await fooCaller.deployed(); await fooCaller.callFoo(signer.address); ``` In this case, you'll get this error: ``` Error: Transaction reverted: function call to a non-contract account at FooCaller.callFoo (contracts/Foo.sol:7) ``` Did you catch the mistake? The last line of the script uses `signer.address` instead of `foo.address`. Notice that the stack trace tells you exactly in which line the error was (`contracts/Foo.sol:7`). In this example is pretty obvious that that was the problematic line, but in more complex projects the stack trace should point you in the right direction. ## Wrong network Another common cause for this error is to assume that some contract exists when it doesn't. Typically this happens because you are accidentally using the wrong network. For example, maybe you are using Hardhat's [forking mode](https://hardhat.org/guides/mainnet-forking.html), but you are forking the wrong network. If you are forking from a specific block number, it can also be the case that you are using an old block number and the contract you expect to exist hasn't been deployed yet.