I won't speak for other forum users, but I personally find it overly difficult to attempt to fix what I can't see and don't have access to.
I am left to throw out wild guesses. Are guesses helpful for you ?
a) you have a typo so a name you think is there, is not the name that is there
b) you aren't accounting for the difference between scripting randomForest calls with bare variable names, versus strings that contain variable names
c) many other possibilities...
Therefore, please, for your own benefit, make a reprex and share it here ?
Shiny debugging and reprex guide - meta - RStudio Community