Repel
Maybe the Pokemon in front is lower lvl than the wild Pokemon
It is most likely because you ran into a patch of shaking grass, bubbling spots, dust clouds, etc.. I think they ignore repels. Another reason could be what mega swifter said
"A Repel is an item which lets the player walk a certain number of steps without encountering wild Pokémon with a lower level than the first member in the player's party."
as Bulbapedia says. http://bulbapedia.bulbagarden.net/wiki/Repel
Hope I helped!
The repel will not work in these cases: