On further researching I found the reason for this cause is due to the meshinstance called before the viewport node you will run into an error only on the first frame. This can be easily fixed by interchanging the scene tree to have the viewport node called first.