When I end a war, sometimes a unit is in a location that just can't get out, forever.

I don't know if this is really a bug, maybe it is a design error, but I doubt it so I post here.

On this screen, you can see that the unit is stuck between the walls of an enemy city, and quite simply a hole.