# Insufficient data for uint256 type (arg="value") on ERC721 minting

**URL:** <https://forum.openzeppelin.com/t/insufficient-data-for-uint256-type-arg-value-on-erc721-minting/4563>\
**Category:** Contracts\
**Tags:** erc721\
**Created:** [November 12, 2020, 5:18pm UTC](https://forum.openzeppelin.com/t/insufficient-data-for-uint256-type-arg-value-on-erc721-minting/4563 "2020-11-12T17:18:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harrison\_Dahme](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/harrison_dahme/32/3502_2.png) [@Harrison\_Dahme](https://forum.openzeppelin.com/u/Harrison_Dahme)\
**Post date:** [November 12, 2020, 5:18pm UTC](https://forum.openzeppelin.com/t/insufficient-data-for-uint256-type-arg-value-on-erc721-minting/4563/1 "2020-11-12T17:18:35Z")

</div>

I’m trying to write a really simple ERC721, but keep running into the following error when trying to mint the token to an address;

`transact to NFT.mintTo errored: Error: insufficient data for uint256 type (arg="value", coderType="uint256", value="0x", version=4.0.47)`

When debugging with Truffle, I get a runtime error at

```auto
set._indexes[value] = set._values.length;
Error: Revert or exceptional halt
  at EnumerableSet._add [address 0x20a13824C80d728dda0B4761f051E4100B832a57] (@openzeppelin/contracts/utils/EnumerableSet.sol:59:13)
  at EnumerableSet.add [address 0x20a13824C80d728dda0B4761f051E4100B832a57] (@openzeppelin/contracts/utils/EnumerableSet.sol:203:16)
  at ERC721._mint [address 0x20a13824C80d728dda0B4761f051E4100B832a57] (@openzeppelin/contracts/token/ERC721/ERC721.sol:339:9)
  at NFT.mintTo [address 0x20a13824C80d728dda0B4761f051E4100B832a57] (/Users/hdahme/Projects/dapps/nft-factory/contracts/NFTFactory.sol:17:7)
  at NFT [address 0x20a13824C80d728dda0B4761f051E4100B832a57] (/Users/hdahme/Projects/dapps/nft-factory/contracts/NFTFactory.sol:13:5)
  at NFTFactory.mint [address 0x5fD6AdC24B58204911f6F683F70a71262eCF7D0E] (/Users/hdahme/Projects/dapps/nft-factory/contracts/NFTFactory.sol:42:7)
  at NFTFactory [address 0x5fD6AdC24B58204911f6F683F70a71262eCF7D0E] (/Users/hdahme/Projects/dapps/nft-factory/contracts/NFTFactory.sol:41:5)
  at ExampleToken.transfer [address 0xB02612e4B658A8C1E13CBe4486F51c34Ec36E6bF] (/Users/hdahme/Projects/dapps/nft-factory/contracts/ExampleToken.sol:21:5)
  at ExampleToken [address 0xB02612e4B658A8C1E13CBe4486F51c34Ec36E6bF] (/Users/hdahme/Projects/dapps/nft-factory/contracts/ExampleToken.sol:18:3)

```

Has anyone encountered this before?

Here’s the complete code;

```auto
pragma solidity ^0.6.0;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.2.0/contracts/token/ERC721/ERC721.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.2.0/contracts/utils/Counters.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.2.0/contracts/token/ERC20/ERC20.sol";

contract NFT is ERC721 {
    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;

    constructor(string memory name, string memory symbol) ERC721(name, symbol) public {
    }

    function mintTo(address recipient, string memory tokenURI) public returns (uint256) {
      _tokenIds.increment();

       uint256 newTokenId = _tokenIds.current();
      _mint(recipient, newTokenId);
      _setTokenURI(newTokenId, tokenURI);

      return newTokenId;
    }
}

```

**💻 Environment**  
Using Remix with compiler 0.6.12

For truffle;  
Truffle v5.1.52 (core: 5.1.52)  
Solidity - 0.6.2 (solc-js)  
Node v14.15.0  
Web3.js v1.2.9

**📝Details**

**🔢 Code to reproduce**

\*\* edited to add truffle debug info

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [November 13, 2020, 6:02am UTC](https://forum.openzeppelin.com/t/insufficient-data-for-uint256-type-arg-value-on-erc721-minting/4563/2 "2020-11-13T06:02:54Z")

</div>

Hi @Harrison_Dahme,

Welcome to the community 👋

I deployed the above contract using Remix and I was able to call `mintTo` with the following parameters: “0x5B38Da6a701c568545dCfcB03FcB875f56beddC4”,“[https://example.com/token/](https://example.com/token/)”

I am not sure what was causing the error that you were seeing.

Please note, in your token, there is no access control, so anyone could call the `mintTo` function.

I suggest having a look at the ERC721 preset contract as an example: [https://docs.openzeppelin.com/contracts/3.x/erc721#Presets](https://docs.openzeppelin.com/contracts/3.x/erc721#Presets)

You may want to look at this guide: [[DRAFT] Create an NFT and deploy to a public testnet, using Truffle](https://forum.openzeppelin.com/t/draft-create-an-nft-and-deploy-to-a-public-testnet-using-truffle/2961)

---

<div class="post-metadata">

**Author:** ![Harrison\_Dahme](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/harrison_dahme/32/3502_2.png) [@Harrison\_Dahme](https://forum.openzeppelin.com/u/Harrison_Dahme)\
**Post date:** [November 13, 2020, 6:31pm UTC](https://forum.openzeppelin.com/t/insufficient-data-for-uint256-type-arg-value-on-erc721-minting/4563/3 "2020-11-13T18:31:57Z")

</div>

Thank you so much @abcoathup! I was able to work backwards from the guide you sent over, and was able to get something working. I’m still not sure what the issue was 🤷‍♂️
