Check Steve's idea first. If that doesn't pan out, check how your encoder is wired, potential issues you are looking for include:
- Intermittent short from power to ground
- Connection to limit switch pin instead of encoder pin (if wiring direct)
- Swarf or other short on limit switch pins (if using breakout)
- Defective encoder causing intermittent short from power to ground.