It can be so frustrating. I try to think of it as my brain's way of saying your off the rails, take a break! Usually it is related to not being committed to what ever you are writing at the time. I find most often a short break to walk the dog, take a shower and allow myself time to process what it is that isn't working will do the trick. Sometimes in an extra long bout with the block, I find a conversation with colleagues or in my case my co-writer can bring a fresh perspective and get you over the hump.