Skip to content
PenyuOnCore
Menu
  • Home
  • Core Ecosystem Analysis
  • Personal Finance & Investing
  • Make Money Online
  • Bitcoin
  • About Us
Menu
OwnableUnauthorizedAccount error explained: owner() != msg.sender reverts, OpenZeppelin v4 revert string vs v5 error 0x118cdaa7

OwnableUnauthorizedAccount Error: What It Means & How to Fix

Posted on November 19, 2026

Your transaction, script or test stops with OwnableUnauthorizedAccount(0x...), or on older contracts with Ownable: caller is not the owner. Nothing is wrong with gas or the network. The contract has an owner-only function, and the address that called it is not the owner. The tricky part is that the “caller” is often not the address you think it is.

Short answer: OwnableUnauthorizedAccount(account) is the custom error OpenZeppelin Contracts 5.x throws when an onlyOwner function is called by an address other than owner(). The account inside the error is the address the contract actually saw as msg.sender. OpenZeppelin 4.x reverts with the string “Ownable: caller is not the owner” for the same check. To fix it, read owner(), compare it with the address in the error, and send the call from the real owner (or have the owner transfer ownership).

What the error actually means

In the current OpenZeppelin Ownable.sol (v5.7.0 at the time of writing), the onlyOwner modifier calls this check:

function _checkOwner() internal view virtual {
    if (owner() != _msgSender()) {
        revert OwnableUnauthorizedAccount(_msgSender());
    }
}

The 4.9 version of Ownable.sol does the same thing with a require:

require(owner() == _msgSender(), "Ownable: caller is not the owner");

The switch came with OpenZeppelin 5.0.0 (released 5 October 2023), where the changelog says revert strings and require statements were “replaced with custom errors”. So the two messages are the same check from different library versions. If your error shows a string, the contract was built with 4.x or earlier. If it shows OwnableUnauthorizedAccount or the raw selector 0x118cdaa7, it was built with 5.x.

Reading the raw revert data

Wallets and RPCs that don’t know the contract’s ABI often show only hex. According to the Solidity docs on custom errors, error data is “a 4-byte selector followed by ABI-encoded data”, where the selector is the first four bytes of the keccak256 hash of the error signature. For this error:

$ cast sig "OwnableUnauthorizedAccount(address)"
0x118cdaa7

$ cast decode-error 0x118cdaa700000000000000000000000070997970c51812dc3a010c7d01b50e0d17dc79c8 \
    --sig "OwnableUnauthorizedAccount(address)"
0x70997970C51812dc3A010C7d01b50e0d17dc79C8

That decoded address is the most useful clue you have. It tells you exactly who the contract thought was calling. Foundry’s cast decode-error can do this, and so can any ABI decoder. A related selector, 0x1e4fbdf7, is OwnableInvalidOwner(address). You get that one when you pass address(0) as the initial owner or as the new owner in transferOwnership.

What it looks like in practice

In a test on a local Anvil node started with Core’s chain ID (anvil --chain-id 1116), a contract built with OpenZeppelin 5.7.0 was deployed from Anvil’s first default account and its owner-only setFee was then called from the second account. cast call returned:

Error: execution reverted: OwnableUnauthorizedAccount(0x70997970C51812dc3A010C7d01b50e0d17dc79C8)

cast send failed earlier, at gas estimation, with the same error. The same contract compiled against OpenZeppelin 4.9.6 returned execution reverted: Ownable: caller is not the owner, encoded as the standard Error(string) selector 0x08c379a0. When the call came from the owner, it succeeded. Core mainnet uses chain ID 1116 (see the Core network config docs), but this check is plain Solidity and works the same way on any EVM chain. If you want to try it against real Core state, see our guide to forking Core mainnet with Anvil.

Diagram of how OpenZeppelin onlyOwner compares owner() with msg.sender and reverts with OwnableUnauthorizedAccount or Ownable: caller is not the owner

The 6 most common causes

1. The wrong account is connected or loaded

MetaMask is on a different account, or your .env loads a different PRIVATE_KEY than the one that deployed. Compare cast call <contract> "owner()(address)" --rpc-url <rpc> with the address in the error. If they differ, switch accounts.

2. A contract is calling, not your wallet

msg.sender is the immediate caller. If your wallet calls a router, factory or helper contract, and that contract calls the owner-only function, the owned contract sees the helper’s address. The fix is either to call the owned contract directly from the owner, or to make the helper the owner on purpose.

3. Foundry script calls made outside the broadcast

This one confuses many people. In a test, a forge script deployed a 5.x contract inside vm.startBroadcast() with msg.sender as owner. That worked, and the owner was the broadcasting account. It then called setFee after vm.stopBroadcast(), and the script failed with OwnableUnauthorizedAccount(0x5b73...0519). That address was the temporary script contract, not the wallet. According to Foundry’s startBroadcast docs, only calls made between start and stop become transactions from your sender. Keep owner-only calls inside the broadcast block. In tests, use vm.prank(owner).

vm.startBroadcast();
MyContract c = new MyContract(msg.sender); // owner = broadcaster
c.setFee(1);                               // OK: sent from broadcaster
vm.stopBroadcast();

4. The owner was set to something else at deployment

In 4.x, the constructor sets the deployer as owner automatically. In 5.x, the Ownable constructor takes an explicit initialOwner argument (also listed in the changelog). If you passed a different address, a factory address or a Safe, that address is the owner. For contracts deployed with Hardhat or Foundry, check your deploy arguments. Our Foundry deployment guide for Core shows where constructor args go.

5. Ownership was transferred, renounced or is still pending

After renounceOwnership(), owner() is address(0). In a test, even the former owner then got OwnableUnauthorizedAccount. The OpenZeppelin access control docs warn that removing the owner means onlyOwner functions “will no longer be callable”. With Ownable2Step, transferOwnership only sets a pending owner. The old owner stays in charge until the new one calls acceptOwnership(). If anyone else calls acceptOwnership(), it reverts with the same OwnableUnauthorizedAccount error.

6. Proxies and uninitialized implementations

For upgradeable contracts, there is no constructor. The owner is set by calling __Ownable_init(initialOwner) inside your initializer (see OwnableUpgradeable.sol). Make sure you call the proxy address, not the implementation. Also note that the proxy admin has its own owner, which may be different from your contract’s owner.

How to fix it, step by step

Step Command or action What you’re checking
1. Decode the error cast decode-error <data> --sig "OwnableUnauthorizedAccount(address)" Who the contract saw as the caller
2. Read the owner cast call <addr> "owner()(address)" Who is actually allowed
3. Check the network and address cast chain-id plus the explorer Right chain, proxy, and contract
4. Fix the sender Switch account, use the broadcast block or vm.prank Call is sent from owner()
5. Transfer if needed Owner calls transferOwnership(newOwner) New owner (and acceptOwnership for 2-step)

If the owner is a Safe multisig, you can’t call the function from one signer’s wallet. Create the transaction in the Safe so the Safe itself is msg.sender. See how to create a Safe multisig on Core. If owner() returns address(0) after a renounce, the owner-only functions are permanently disabled for that deployment unless the contract has another upgrade or admin path.

Testing for the error in Foundry

To assert the 5.x error in a unit test, encode the selector together with the expected caller (see expectRevert):

vm.prank(bob);
vm.expectRevert(abi.encodeWithSelector(Ownable.OwnableUnauthorizedAccount.selector, bob));
c.setFee(1);

For a 4.x contract, use vm.expectRevert("Ownable: caller is not the owner");. For other reverts that don’t match this pattern, our general execution reverted guide covers how to find the reason.

FAQ

Is “OwnableUnauthorizedAccount” the same as “Ownable: caller is not the owner”?

Yes. It’s the same owner check. OpenZeppelin 5.x reverts with the custom error, which includes the caller’s address. 4.x and earlier revert with the string.

Why does the address in the error not match my wallet?

Because something else was the immediate caller: a helper or router contract, a Foundry script contract (calls outside vm.startBroadcast()), or a different account loaded from your environment.

Can I get around the error as a regular user?

No. If a dApp shows this error, the function is reserved for the contract’s admin. It isn’t a wallet or gas problem, and retrying won’t help.

Does Core blockchain handle this error differently?

No. Core’s docs describe it as a fully EVM-compatible Layer 1, and the check runs inside the contract’s own bytecode. So it behaves the same on chain ID 1116 as on other EVM chains. Just follow Core’s smart contract guidelines and compile with evmVersion set to shanghai.

Disclaimer: This article is for educational purposes only. It is not financial, legal or security advice. Always test on a local node or testnet, double-check owner addresses before transferring or renouncing ownership, and do your own research.

Recent Posts

  • OwnableUnauthorizedAccount Error: What It Means & How to Fix
  • Kajabi Payout Schedule: When Kajabi Payments Pays You (2026)
  • “ERC20: Transfer Amount Exceeds Balance” Error: What It Means and How to Fix It
  • “Exceeds Block Gas Limit” Error: What It Means and How to Fix It
  • How to Change Your TreasuryDirect Bank Account (2026 Guide)
Subscription form is not available at the moment
  • Altcoin News
  • Bitcoin
  • Core Ecosystem Analysis
  • DeFi
  • Free Crypto Signals
  • Make Money Online
  • Personal Finance & Investing
  • Token Analysis
  • About Us
  • Contact
  • Privacy Policy
  • Disclaimer
©2026 PenyuOnCore | Design: Newspaperly WordPress Theme