This is the error in all of the tests in which I am expecting an emit, been struggling with this since many days, any help would really be appreciated.

I also tried creating events in a new contract and still got this particular error.

vm.prank works, vm.expectRevert and other vm functions work too but only the .expectEmit function causes an error.

Code for the test

function testCanSubmitTransaction() public {
        emit Submit(0);
        multisig.submit(address(owner2), 1 ether, "");

Code of the Submit function

function submit(
        address _to,
        uint256 _value,
        bytes calldata _data
    ) public onlyOwner {
            Transaction({to: _to, value: _value, data: _data, executed: false})
        emit Submit(transactions.length - 1);

2 Answers 2


Apparently .expectEmit() takes in 4 bool arguments and/or an address (this code is from Vm.sol)

function expectEmit(bool,bool,bool,bool) external;
function expectEmit(bool,bool,bool,bool,address) external;

So adding 3 extra false to my code works!

Fixed Code:

function testCanSubmitTransaction() public {
        vm.expectEmit(true, false, false, false);
        emit Submit(0);
        multisig.submit(address(owner2), 1 ether, "");


  • 1
    Actually, your answer is not complete since the question does not make it clear whether the parameter in the Submit event is indexed or not. If the parameter is indexed, then your answer is correct. If not, then the vm.expectEmit params need to be set to vm.expectEmit(false, false, false, true);. Full explanation is available in the docs: book.getfoundry.sh/forge/cheatcodes Commented Oct 31, 2022 at 19:29
  • Actually, this answer was really helpful to me even now almost a year and half later after this question was asked. Events can have a up to a max of three indexable events and the fourth parameter specifies whether or not to check the data. Writing docs is hard and I think the docs could be improved with more examples to better clarify this. Commented Feb 14 at 20:53

Not the user's original problem, but results in the same error message:

If you want to use expectRevert(MyCustomError), you have to use expectRevert(MyCustomError.selector), instead. You get this error because the compiler goes looking for an implementation of function expectRevert(Error error), but there is no such implementation. The call expectRevert(MyCustomError.selector) instead invokes function expectRevert(bytes4 errorSelector).

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.