I finally worked my way out of this recently. It comes and goes, often when I am very productive.
Combinations of constant negative criticism, vague+ambiguous requirements, and argumentative coworkers (seriously, they would argue about the order of words, or who was actually AGREEING with whom). I went from sleeping 8 hours every night to getting 2 hours most nights, then 10.