tokenURI is meant to reject queries for tokens that do not exist, and the contract declares error ERC721Metadata__URI_QueryFor_NonExistentToken() for that purpose.
The guard compares ownerOf(tokenId) against the zero address. That pattern belongs to OpenZeppelin v4. In v5 — which this project uses — ownerOf routes through _requireOwned and reverts with ERC721NonexistentToken(tokenId) rather than returning address(0). Control therefore never reaches the comparison, the custom error can never be thrown, and the branch is dead code.
Likelihood:
On every tokenURI call for a nonexistent token — the one case the branch was written to handle.
Impact:
Callers and integrators receive ERC721NonexistentToken(uint256) while the contract's ABI advertises ERC721Metadata__URI_QueryFor_NonExistentToken(). Any front end or indexer that decodes the declared error will fail to match the revert.
Dead code and an unreachable error selector in a deployed contract: misleading to reviewers and wasteful of deployment gas. No funds are at risk.
Paste the harness and test function(s) into test/PoC.t.sol, placing test functions inside contract PoC. Any additional helper contracts go outside contract PoC. Run forge test --match-path test/PoC.t.sol -vv.
Asserting that the OpenZeppelin error fires proves the contract's own branch is never evaluated.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.