ERC721Enumerable Infinite Gas issue

Hi attached is a basic contract constructed on OpenZeppelin and inserted into remix.ethereum.org. Using solidity no matter what contract is compiled I continually get a "infinite gas" cost. How can I solve this and get the gas cost below the 3M default. Please suggest the problem to me I need some help.

Please post this in plain text.

Here is the contract in plain text.. this does not show what talking about however. Solidity shows infinite gas cost when I use OpenZeppelin. Why?

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

contract Livesstar_Herb_Grinder is ERC721, ERC721Enumerable, ERC721URIStorage, Ownable {
using Counters for Counters.Counter;

Counters.Counter private _tokenIdCounter;

constructor() ERC721("Livesstar_Herb_Grinder", "LHG") {}

function _baseURI() internal pure override returns (string memory) {
    return "livestar.io";
}

function safeMint(address to, string memory uri) public onlyOwner {
    uint256 tokenId = _tokenIdCounter.current();
    _tokenIdCounter.increment();
    _safeMint(to, tokenId);
    _setTokenURI(tokenId, uri);
}

// The following functions are overrides required by Solidity.

function _beforeTokenTransfer(address from, address to, uint256 tokenId, uint256 batchSize)
    internal
    override(ERC721, ERC721Enumerable)
{
    super._beforeTokenTransfer(from, to, tokenId, batchSize);
}

function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) {
    super._burn(tokenId);
}

function tokenURI(uint256 tokenId)
    public
    view
    override(ERC721, ERC721URIStorage)
    returns (string memory)
{
    return super.tokenURI(tokenId);
}

function supportsInterface(bytes4 interfaceId)
    public
    view
    override(ERC721, ERC721Enumerable, ERC721URIStorage)
    returns (bool)
{
    return super.supportsInterface(interfaceId);
}

}

Change this:

override(ERC721, ERC721Enumerable, ERC721URIStorage)

To this:

override(ERC721, ERC721Enumerable)

Thanks for the help. I will try that in an hour or so and get back to you.

By removing ERC721URIStorage from that line the code errored. Therefore I removed the ERC721URIStorage from each line in the entire contract just to see if the infinite gas would erase. Still it says infinite gas cost. ..

Not sure what you mean by that, but I actually had to remove ERC721URIStorage from that line (as shown in my original answer) in order to remove an error.

A compilation error, in my case.

So you need to clarify exactly what you mean by "the code errored".
For example, by providing the error-message that you're getting.

It is also possible that we're using different versions of OpenZeppelin code.
I've tested the above with version 4.8.2, so whenever you reply to this, please specify which version you're using (in addition to describing the error aforementioned).

Thank you kindly for working with me first off. Now please just look at the very first message I sent with the screen shot. There is inifinte gas? Can you tell me why this is. Removal of the URI is something I need to have. Alternatively look into this contract as I need this instead. The other was just a test for me. I would like to launch the code as follows:
pragma solidity ^0.8.0;

contract Livestar_Herb_Grinder is ERC721Enumerable, Ownable {
using Strings for uint256;
string public baseURI;
string public baseExtension = ".json";
uint256 public cost = 0.025 ether;
uint256 public maxSupply = 100;
uint256 public maxMintAmount = 5;
bool public paused = false;

constructor() ERC721("Livestar_Herb_Grinder", "LHG") {}
    // internal
    function _baseURI() internal view virtual override returns (string memory) {
    return "ipfs://QmNrvxbNG2HBS8UgSGodjTs5CUXJXaickJzN2m7PHa15LY/";
}
    // public

    function mint(address _to, uint256 _mintAmount) public payable {
        uint256 supply = totalSupply();
        require(!paused);
        require(_mintAmount > 0);
        require(_mintAmount <= maxMintAmount);
        require(supply + _mintAmount <= maxSupply);
        
        if (msg.sender != owner()) {
        require(msg.value == cost * _mintAmount, "Need to send 0.025 ether!");
        }
        
        for (uint256 i = 1; i <= _mintAmount; i++) {
            _safeMint(_to, supply + i);
        }
    }

    function walletOfOwner(address _owner)
    public
    view
    returns (uint256[] memory)
    {
        uint256 ownerTokenCount = balanceOf(_owner);
        uint256[] memory tokenIds = new uint256[](ownerTokenCount);
        for (uint256 i; i < ownerTokenCount; i++) {
            tokenIds[i] = tokenOfOwnerByIndex(_owner, i);
        }
        return tokenIds;
    }

    
    function tokenURI(uint256 tokenId)
    public
    view
    virtual
    override
    returns (string memory) {
        require(
            _exists(tokenId),
            "ERC721Metadata: URI query for nonexistent token"
            );
            
            string memory currentBaseURI = _baseURI();
            return
            bytes(currentBaseURI).length > 0 
            ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension))
            : "";
    }
    // only owner
    
    function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner() {
        maxMintAmount = _newmaxMintAmount;
    }
    
    function setBaseURI(string memory _newBaseURI) public onlyOwner() {
        baseURI = _newBaseURI;
    }
    
    function setBaseExtension(string memory _newBaseExtension) public onlyOwner() {
        baseExtension = _newBaseExtension;
    }
    
    function pause(bool _state) public onlyOwner() {
        paused = _state;
    }
    
    function withdraw() public payable onlyOwner() {
        require(payable(msg.sender).send(address(this).balance));
    }

}

I am not very well familiar with Remix, so I've assumed that this error implies a transaction revert.
Since you asked about contract deployment, this meant a transaction revert during construction.
So I asked for the source code in plain-text, in order to make the investigation of it easier for me.
And when I did, I noticed that the override(ERC721URIStorage) part was causing a compilation error.
As I mentioned, it might be the result of using a different OZ version, so I asked you to specify yours.

P.S.: I am able to deploy your contract successfully on HardHat.

Good Morning,
That's awesome you where able to deploy it! I am following this guide on YouTube. Getting close now with the tutorial therefore I will keep in touch. I might need more help from you. Kindly > 4-Art

Okay Please if your still with me this is my new problem. Firstly please if you could give me instructions on how you where able to deploy the contract. I tried using Goreli as a test net but no luck. What network did you try? Do you know how much this will cost on Ethereum once I truly deploy. Not sure how much I will need to load in my wallet. Please help I made an excellent webpage already. Below is the message I receive in the terminal once im ready and this is blocking me.

For more info go to https://hardhat.org/HH100 or run Hardhat with --show-stack-traces