New to Rust? Grab our free Rust for Beginners eBook Get it free →
How to Solve a Reverted Transaction Error in Solidity

When Remix reports that a Solidity transaction reverted, the call reached a condition that the Ethereum Virtual Machine could not complete. The fastest repair starts with the revert reason, then checks the call value, sender, contract state, and any external call before changing the contract.
How to solve a reverted transaction error in Solidity
A revert rolls back the state changes made by the failing call, but it does not identify the source by itself, so treat the message as the start of a diagnosis rather than a fix.
- Read the full Remix terminal message, including a reason string, custom error, or panic code.
- Check the function arguments, the selected account, and the value field in the Deploy and Run panel.
- Use Remix Debugger on the failed transaction to locate the instruction that reverted.
Solidity documents require, revert, assert, and exceptions as state-reverting error paths, where a failed require usually means an input or state rule was not met and a Panic usually points to an internal condition such as arithmetic outside an unchecked block.
Check the transaction inputs before editing the contract
A payable function can receive the native currency value attached to its call. Sending value to a function that is not payable reverts, and a payable function can still reject the call when its own condition rejects msg.value.
Verify the value unit
Remix lets you choose a value and unit before sending a transaction, so a contract that expects 0.01 ether rejects 0.01 wei even though the visible number looks familiar.
Read the condition in the contract and enter the matching unit in Remix, because a revert caused by a minimum deposit is a contract rule working as written.
Verify the sender and contract state
Access checks often depend on msg.sender, so switching Remix accounts can make the same function revert. A paused contract, an already-used identifier, an empty balance, or a missing approval can also make a valid-looking call fail.
Inspect the public state variables that control the function before retrying. If the contract calls another contract, inspect that call too because a downstream revert also reverts the outer transaction.
Add an error that names the failed rule
A generic revert leaves the caller with little to inspect, while current Solidity supports custom errors that return the values explaining why a rule rejected the transaction.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract TransactionGuard {
error MinimumDeposit(uint256 sent, uint256 minimum);
error OwnerOnly(address caller);
error TransferFailed();
address public immutable owner;
uint256 public constant MINIMUM_DEPOSIT = 0.01 ether;
constructor() {
owner = msg.sender;
}
function deposit() external payable {
if (msg.value < MINIMUM_DEPOSIT) {
revert MinimumDeposit(msg.value, MINIMUM_DEPOSIT);
}
}
function withdraw(address payable recipient) external {
if (msg.sender != owner) {
revert OwnerOnly(msg.sender);
}
(bool sent, ) = recipient.call{value: address(this).balance}("");
if (!sent) {
revert TransferFailed();
}
}
}

I compiled this contract with solc 0.8.36, and the compiler returned exit 0. Compilation proves that the source is valid for that compiler, while a transaction test still needs the sender, value, deployed state, and recipient behavior used by your call.
Debug the reverted transaction in Remix
Remix records the transaction in its terminal, where you can open the failed entry and select Debug to step through executed instructions and inspect Solidity locals, state, calldata, and the reverting instruction.
Start at the first failure rather than changing several lines at once, then compare the displayed msg.value with MINIMUM_DEPOSIT when the debugger reaches MinimumDeposit.
Common reasons a Solidity transaction reverts
These checks cover the failures that the old message “the transaction has been reverted to the initial state” did not explain.
| What you see | What to inspect | Typical correction |
|---|---|---|
| Custom error or require reason | The condition and its input values | Meet the rule or change the rule deliberately |
| Function is not payable | The function declaration and the transaction value | Remove the value or make the function payable when receiving value is intended |
| Owner-only failure | The selected account and owner value | Use the authorized account or change the access design |
| Panic code | Arithmetic, array access, and assertions | Fix the invariant that caused the internal failure |
| External call failure | The recipient contract and its return data | Handle the failed call and test the receiving contract |
Gas settings deserve attention when the node reports an out-of-gas failure, but raising the gas limit does not repair a require condition or an access check. Keep the diagnosis tied to the reason returned by the failed execution.
FAQ
A reverted transaction can look similar across many causes, so the error data and debugger trace are more useful than the generic terminal line.
Why does a Solidity transaction revert without a message?
The contract may use a bare revert, an external call may fail without useful return data, or the failure may be an exception. Use Remix Debugger to find the instruction and add a reason string or custom error where you control the contract.
Does making a function payable fix a reverted transaction?
Only when the call is intended to receive native currency value. A payable function still reverts when its conditions reject the sender, amount, state, or downstream call.
What should I inspect first in Remix Debugger?
Locate the instruction that reverts, then inspect the Solidity locals and state used by that condition. Connect those values to the transaction inputs before changing the source.
Run the failed transaction in Remix Debugger and write down the first condition that rejects it. That condition tells you whether the next change belongs in the call, the contract state, or the contract logic.




