Skip to content

Hardhat Error: "Transaction reverted without a reason string" #6794

Answered by TatyOko28
houstonTaleubou asked this question in Q&A
Discussion options

You must be logged in to vote

This error happens when a smart contract function reverts, but does not include a custom error message. Possible causes:

Check for require/assert statements in the contract:
Example of a failing contract:

require(msg.sender == owner); //  No reason string

Fix it by adding a message:

require(msg.sender == owner, "Caller is not the owner"); //  Clear error message

Ensure enough gas is provided in the transaction:
Try increasing gas limit:

await contract.functionName({ gasLimit: 1000000 });

Check if the contract has enough funds:
For payable functions, ensure sufficient ETH or token balance.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by houstonTaleubou
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants