This error occurs when in the MakeCode editor simulator when it is trying to process the program and there is an error in the code. This is usually caused by an undeclared variable.
Check all the variables have been declared and have valid values assigned to them. Try setting these in the OnStart block if you are unsure.
Open a support ticket or if you have a Github account, an issue on pxt-microbit