Were you allied or NAP'd with any AI? If you are, the pathfinding will try to move you through friendly cities, but if the cities are garrisoned, you can't step over them, so the pathfinding freaks out. Yes it's dumb
I once got almost completely stuck due to this (and I still can't figure out how to break a NAP) - I had to resort to casting raise land repeatedly to build a very expensive land bridge AROUND allied cities.