Transaction reverted: function returned an unexpected amount of data

When i test with hardhat my arbitrage trading bot i get this error: Error: Transaction reverted: function returned an unexpected amount of data from this function here:

function executeTrade(
        address _tokenA,
        address _tokenB,
        uint _tokensFromFlashLoan,
        bool _startOnUniswap
    ) external {
        uint balanceBefore = IERC20(_tokenA).balanceOf(_tokenA);
        bytes memory data = abi.encode(
            _startOnUniswap,
            _tokenA,
            _tokenB,
            _tokensFromFlashLoan,
            balanceBefore
        );
        flashloan(_tokenA, _tokensFromFlashLoan, data);
    }

The error comes from this line: uint balanceBefore = IERC20(_tokenA).balanceOf(address(this));
I dont know what this line is returning of unexpected, if you have any suggestion please help me its now 2 weeks that im stuck on this bug and any type of help would really help me out.

I'd first make sure that _tokenA is the address of an ERC20 contract deployed on the chain that you're testing against.

As a side note, I'd tell you that the balance of an ERC20 token contract on itself is generally expected to always be zero (any such balance would typically be non-retrievable by whoever sent it there, unless the author of the contract has implemented a function which allows to withdraw it somehow).