There are some “common” cases which may lead to strange movement behavior.
If you are using a different target pos for moving into the room and are calculating a new path as soon as you enter the room, the new path may be a route through the room where you actually came from (entering through an other entrance). As soon as the creep is leaving again, your other code part may calculate a simple path into the room again (e.g. to pos 25/25), and the procedure repeats. Setting maxRooms = 1 for path calculation after entering the target room, will force to take a path through that room only. It’s a quick solution for the problem. While it may still be an issue in “certain” scenarios, where you have to take another path into the room at all…
There may be some scenarios, where path calculation becomes expensive (cpu operations). There is a maxOps parameter, preventing to exceed a threshold (default:2000 (~2cpu)). You will not get a valid path if that threshold is reached. Increasing that threshold can solve the problem, but may lead to cpu issues if you are not caching paths. But I guess this one is more relevant for inter-room paths…