Lesson:14 call revert exception; VM Exception while processing transaction #5035
-
I follwed the tutorial video and got this error: Error: call revert exception; VM Exception while processing transaction: reverted with reason string "URI Query for nonexistent token" [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="tokenURI(uint256)", data="0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001f55524920517565727920666f72206e6f6e6578697374656e7420746f6b656e00", errorArgs=["URI Query for nonexistent token"], errorName="Error", errorSignature="Error(string)", reason="URI Query for nonexistent token", code=CALL_EXCEPTION, version=abi/5.7.0) my repo: https://github.com/Shawon-Mandal/Lesson-14-NFT Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Can you leave a repo link please. Also spell check your contract at this function:
|
Beta Was this translation helpful? Give feedback.
-
@Shawon-Mandal This is the issue due to the invalid token Id because while minting you are updating the token id first and then minting an NFT due to that your first NFT index starts at 1 but in the mint file you are accessing at index 0. function mintNft(int256 highValue) public {
s_tokenIdToHighValue[s_tokenCounter] = highValue;
_safeMint(msg.sender, s_tokenCounter);
s_tokenCounter = s_tokenCounter + 1;
emit CreateNFT(s_tokenCounter, highValue);
} You should update it after |
Beta Was this translation helpful? Give feedback.
-
@alymurtazamemon @paulcoffee85 Can't thank you enough for helping me throughout this course! |
Beta Was this translation helpful? Give feedback.
@Shawon-Mandal This is the issue due to the invalid token Id because while minting you are updating the token id first and then minting an NFT due to that your first NFT index starts at 1 but in the mint file you are accessing at index 0.
You should update it after
_safeMint
.