My laser is not working properly

My laser will come on but when it does it goes all the way to the other side hitting the railing like it wants to keep going then it stops and want do anything

Do you have limit switches installed, if so, check the connection and wiring to those? The switch may be failing, so I would check that as well.