Hardhat Error: "Transaction reverted without a reason string" #6794
Answered
by
TatyOko28
houstonTaleubou
asked this question in
Q&A
-
Why does my transaction fail with "Transaction reverted without a reason string"? |
Beta Was this translation helpful? Give feedback.
Answered by
TatyOko28
Feb 9, 2025
Replies: 1 comment
-
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: 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: await contract.functionName({ gasLimit: 1000000 }); Check if the contract has enough funds: |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
houstonTaleubou
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
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.