As reported by @Langbart, when tasking to garrison and queuing a gather order, there occurs an infinite loop:
Order.Gather -> MustKill (L497) -> PushOrderFront(Attack) (L526) -> NotInRange (L410) -> NotAbleToMove, thus finish order (L426/427) -> Restart from Order.Gather.
Fix this by assuming we don't have vision whilst garrisoned, which is not a bad assumption.
It will now try to walk there, fail, arrive at Order.Gather again, notice it is its second try and finish its order.