# Can't call read function on cloned UUPSUpgradeable contract

**URL:** https://forum.openzeppelin.com/t/cant-call-read-function-on-cloned-uupsupgradeable-contract/44391
**Category:** Support
**Tags:** proxies
**Created:** [June 21, 2025, 9:44pm UTC](https://forum.openzeppelin.com/t/cant-call-read-function-on-cloned-uupsupgradeable-contract/44391 "2025-06-21T21:44:48Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ninjasolution](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/ninjasolution/32/22746_2.png) [@ninjasolution](https://forum.openzeppelin.com/u/ninjasolution)
#### Post date: [June 21, 2025, 9:44pm UTC](https://forum.openzeppelin.com/t/cant-call-read-function-on-cloned-uupsupgradeable-contract/44391/1 "2025-06-21T21:44:48Z")

</div>

I want to know why I can't call the `getTokenId()` read function on the cloned `UUPSUpgradeable` contract.  
I cloned the contract and called the `initialize()` function on the instance correctly.  
The write function `createAgent()` works fine, but the read function `getTokenId()` doesn't work, so I reverted it.  
And I tested the entire original contract and it works fine.

#### 🔢 Code to reproduce

```auto
contract BEP007Enhanced is
    IBEP007,
    ERC721Upgradeable,
    ERC721EnumerableUpgradeable,
    ERC721URIStorageUpgradeable,
    ReentrancyGuardUpgradeable,
    OwnableUpgradeable,
    UUPSUpgradeable
{
    using CountersUpgradeable for CountersUpgradeable.Counter;

    CountersUpgradeable.Counter private _tokenIdCounter;

    function initialize(
        address governanceAddress
    ) public virtual initializer {
        require(governanceAddress != address(0), "BEP007Enhanced: governance address is zero");

        __ERC721_init(name, symbol);
        __ERC721Enumerable_init();
        __ERC721URIStorage_init();
        __ReentrancyGuard_init();
        __Ownable_init();
        __UUPSUpgradeable_init();

        governance = governanceAddress;
        _transferOwnership(governanceAddress);
    }

    function createAgent(string memory metadataURI) external {
     _tokenIdCounter.increment();
        uint256 tokenId = _tokenIdCounter.current();

        _mint(to, tokenId);
        _setTokenURI(tokenId, metadataURI);
    }

    function getTokenId() external view returns (uint256) {
        return _tokenIdCounter.current();
    }
}

```

#### 💻 Environment

Hardhat test environment

---

<div class="post-metadata">

### Author: ![forum01](https://avatars.discourse-cdn.com/v4/letter/f/977dab/32.png) [@forum01](https://forum.openzeppelin.com/u/forum01)
#### Post date: [June 25, 2025, 4:40pm UTC](https://forum.openzeppelin.com/t/cant-call-read-function-on-cloned-uupsupgradeable-contract/44391/2 "2025-06-25T16:40:14Z")

</div>

Ensure `getTokenId()` is a `public` or `external` view function and doesn’t have restrictions like `onlyOwner` or other modifiers that prevent access.
