Oh! That's not a bug or glitch, but rather a feature in the game.
Your energy is, well, your energy. When it runs out, you're tired, so you lose control on doing your work.
Imagine just getting really weary at the factory and not paying attention to the conveyor since you're really tired.