This is a very common symptom of anxiety my therapist told me. You can try to relax in that situation take a deep breath and try to divide your task into smallpieces. It helped me, might work for you as well.
Seems like anxiety. You need to do some breathing exercises to relax and control it