I'm getting ERC721 transfer of token that is not own error when trying to buy a token, I don't want to store the token in the marketplace SM and it should be stored in the seller wallet. any help, please?

Unhandled Rejection (Error): cannot estimate gas; transaction may fail or may require manual gas limit (error={"code":-32603,"message":"execution reverted: ERC721: transfer of token that is not own","data":{"originalError":{"code":3,"data":"0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000294552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e0000000000000000000000000000000000000000000000","message":"execution reverted: ERC721: transfer of token that is not own"}}}, method="estimateGas", transaction={"from":"0xFeB43BA464258c453D7aA678210fD49zxnFRgfBN","to":"0x81b6BfD84f5FBa7c737382Bd535875DDF4bFD443","value":

Creat ERC721 Token:

function createToken(string memory _tokenURI) public returns (uint) {
    uint256 newItemId = _tokenIds.current();

    _mint(msg.sender, newItemId);
    _setTokenURI(newItemId, _tokenURI);
    setApprovalForAll(contractAddress, true);
    return newItemId;}

Put on Sale and transfer:

function createSale( 
        address nftContract,
        uint256 itemId
    ) public payable nonReentrant {
    uint price = idToMarketItem[itemId].price;
    uint tokenId = idToMarketItem[itemId].tokenId;
    require(msg.value == price, "Please submit the asking price in order to complete the 

    IERC721(nftContract).transferFrom(owner, msg.sender, tokenId);
    idToMarketItem[itemId].owner = payable(msg.sender);
    idToMarketItem[itemId].sold = true;
  • From the error message it looks like the market isn't approved to transfer the tokens. I'd check the approve details.
    – Ismael
    Aug 29, 2021 at 3:23

1 Answer 1


If you look at the error you will see

ERC721: transfer of token that is not own"

Which is I think returned by a require() function. You can check it's condition but as the messages says, you are trying to transfer a token but you don't have that token.

  • Yes I shouldn't store the token in the marketplace and it should be stored in the seller wallet that is why I implemented the setApprovalForAll() but it seems I'm missing something:( Aug 25, 2021 at 16:29
  • Honestly, I didn't understand what you are trying to do Aug 25, 2021 at 17:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.