ERC-721 Error 0x7e273289: ERC721NonexistentToken Custom Revert
Error 0x7e273289 is the OpenZeppelin Contracts v5 custom error ERC721NonexistentToken(uint256 tokenId). It occurs when a user or smart contract calls ownerOf, tokenURI, transferFrom, or getApproved for an NFT tokenId that has not been minted or has been burned. This commonly happens on NFT marketplaces when buyers attempt to purchase already-burned NFTs or query invalid token IDs. Verify that the tokenId exists on-chain before calling. Inspect the contract total supply or mint events before initiating calls.
# Root Cause & Technical Architecture
In OpenZeppelin v5 ERC721, `_requireOwned(uint256 tokenId)` retrieves the owner of the token from internal storage: `address owner = _ownerOf(tokenId); if (owner == address(0)) revert ERC721NonexistentToken(tokenId)`. The 4-byte custom error selector is `0x7e273289` (`keccak256("ERC721NonexistentToken(uint256)")`). Calling functions like `tokenURI()` or `ownerOf()` on an unminted token triggers this revert.
# 4-Step Actionable Diagnostic Protocol
Step-by-Step ResolutionVerify Token Mint Status On-Chain
Query the NFT contract totalSupply() and check Transfer events from address(0) to confirm the specific tokenId was successfully minted.
Check Token Burn Status
Check if the tokenId was sent to address(0) or a dead address in a burn event, which deletes ownership records and triggers 0x7e273289.
Verify 0-Indexed vs 1-Indexed Token ID Sequencing
Check whether the NFT collection begins its token IDs at index 0 or index 1. Querying token ID 0 on a 1-indexed collection immediately reverts.
Refresh Marketplace Indexer Metadata Cache
If purchasing on OpenSea or Blur, refresh metadata to ensure you are not buying an NFT that was already transferred or burned in another transaction.
# Diagnostic Verification Code / Command
solidity// OpenZeppelin Contracts v5.0.0 (token/ERC721/ERC721.sol)
error ERC721NonexistentToken(uint256 tokenId);
// 4-byte selector: 0x7e273289
function _requireOwned(uint256 tokenId) internal view returns (address) {
address owner = _ownerOf(tokenId);
if (owner == address(0)) {
// Reverts with selector 0x7e273289 + tokenId
revert ERC721NonexistentToken(tokenId);
}
return owner;
} Launch ERC-4337 UserOp Decoder
Execute client-side cryptographic simulation and parameter checks safely in your browser via native WebCrypto without sending private keys or mnemonics over the wire.
Read Full Investigation & Recovery Workflow
Explore complete architectural diagrams, edge-case failure trees, and detailed post-mortem analysis in our verified deep guide.
# Related Diagnostic Codes in EVM & JSON-RPC
Related Hex StatusesJSON-RPC Error -32000: Insufficient Funds for Gas * Price + Value
Fix JSON-RPC error -32000 insufficient funds for gas * price + value. Resolve native token balance shortages, fee estimation surges, and gas caps.
JSON-RPC Error -32000: Replacement Transaction Underpriced Fix
Fix JSON-RPC error -32000 replacement transaction underpriced. Apply mandatory 10%+ maxPriorityFeePerGas bump on same nonce to replace stuck mempool txs.
JSON-RPC Error -32000: Nonce Too Low Stale Wallet State Fix
Fix JSON-RPC error -32000 nonce too low. Troubleshoot stale local wallet nonce caches, pending mempool transactions, and reset account state.
# Frequently Asked Questions
FAQ SchemaWhat is the legacy string equivalent of 0x7e273289?
In OpenZeppelin v4, the equivalent error was the string revert "ERC721: invalid token ID" or "ERC721: owner query for nonexistent token".
Can I query tokenURI on a token before it is minted?
No. ERC-721 metadata queries require the token to be minted. Querying an unminted token ID will revert with 0x7e273289.
How do I decode which tokenId failed from the revert data?
The remaining 32 bytes after 0x7e273289 encode the uint256 tokenId. Convert the hex string to decimal to see the exact token ID.