Flock of Wolves

"''"There were names, and lines connecting the names to other names, and some of the lines were in different colors and... ' Tell me,' said General Granger, 'is there anyone in my army who isn't a spy?'""

- Harry Potter and The Methods of Rationality

Somebody disguises themselves as a member of some group to sneak among them. However, it turns out everyone else in the area is also in disguise. Primarily used in comedy.

If they turn out to have been on the same side too, then it is Right Hand Versus Left Hand. Sometimes the result of a Gambit Pileup. Might also drive a character to demand: "Okay, will the real [X] please stand up?" - and then everybody stands up.

In general, a favorite scene for any crime show writer is to have the primary detectives bust an operation, only to find out that the people they're busting are cops themselves. Depending on how much hilarity the writers are going for, there may be as many as three or four squads in the room at the time.

Compare/contrast I Am Spartacus.

Due to the nature of this trope, spoilers abound.

Anime & Manga
""You see that dog crossing the road there? It's a Mossad spy dog!""
 * In an episode of Slayers Next, the team infiltrates a kingdom dedicated to training priestesses, and takes it so seriously it's supposedly a Lady Land which will execute any man found near its borders, never mind in the city. As it turns out, it's actually full of Wholesome Crossdressers -- even the princess is actually the prince, forced to pretend to be a girl because his crazy mother didn't want to annul the rule, yet didn't want to execute her son either.
 * In another episode in Slayers Revolution,
 * In one of the Project A-ko OVAs, every single customer at the Lepton-mothership-turned-restaurant turns out to be a disguised spy... all for different organizations. Cue Blast Out.
 * One episode of the Patlabor TV show had them helping the Japanese intelligence service pick up a Soviet defector & his experimental Humongous Mecha in a seaside resort town. Every single person there was said to be a spy of some sort. The one that really takes the biscuit being:


 * This is kinda what happens in The Melancholy of Haruhi Suzumiya, except that Kyon, the Meta Guy protagonist, isn't one of the "wolves" and is dragged into the title character's Club For Finding Aliens, Time-Travelers, and Espers by force. However, it soon turns out that every other member of the club (including the founder) is some kind of supernatural being that they are supposed to look for. In a way, the title character invoked this trope without being aware of it, due to being a Wrong Genre Savvy Reality Warper.

Comic Books

 * This happens in one of the prequel comics for Smokin Aces.
 * One strip of Twisted Toyfare Theatre had Reed Richards turn into a Skrull and gloat to Susan Richards about having tricked her into having sex with him. She promptly turns into another (male) Skrull and replies "Bob, you idiot."
 * In a Don Martin Mad Magazine gag strip, all the passengers on an airplane look around shiftily. Then they all get up at the same time, brandishing a weapon, and shout "All right, nobody move! This is a hijack!" Everyone looks at each other and sits down, embarrassed.
 * A cartoon that ran in one magazine showed Hispanic-looking revolutionaries overrunning the dictator's office. The dictator, confronting the revolutionary leader, snarled, "You fool — I'm CIA, too!"
 * See the Miracleman example under Not My Driver. To go into a bit more detail:
 * One Nightwing comic featured an entire town where almost every inhabitant was someone in the Witness Relocation program.

Film

 * Early in Monty Python's Life of Brian, Brian's mother disguises herself as a man to attend a stoning. Every other 'man' there was also a woman wearing a beard.
 * Compounded by the fact that, this being a Monty Python film, the 'women' are actually being played by male actors. So we had Terry Jones pretending to be a woman who was pretending to be a man.
 * In Fight Club, the Narrator attends support groups, despite the fact that he's not suffering from anything fatal (except insomnia). He finds Marla Singer doing the same thing, which ruins his ability to sleep.
 * In the movie Traitor,
 * My Blue Heaven, a mafioso turned protected witness is accused of a crime by the local police. In order to avoid being convicted, he offers the police a deal: he knows of some mafia in the area who are looking to buy stolen goods. He gives them the information, they drop the charges. The police burst in, only to find the buyers are actually undercover FBI agents doing a stakeout.

Literature
""The park was deserted except for a member of MI9 trying to recruit someone who, to their later mutual embarrassment, would turn out to be also a member of MI9.""
 * In the Monstrous Regiment, the main character disguises herself as a man to join the army, only to find that nearly every single member of her squad is also a woman in disguise. Their disguises, including that of the pregnant Shufti, are so effective that when they opt to try the old "pretend to be the washerwomen" trick, Blouse deems himself the only one sufficiently capable of acting female to pass muster. (And he's right -- he makes past the guards just fine, while the rest of them have rather more difficulty. The real washerwomen, who are mostly the indentured wives of the soldiers on their side, aren't fooled by Blouse's antics, but play along anyway.)
 * Also, one of Discworld's many, many footnotes relates how aliens have had to stop abducting people from the Earth, because so many different extraterrestrial species have been doing so, or monitoring each others' attempts to do so, that they've only succeeded in abducting other aliens. And one native with large feet.
 * The Discworld Companion describes how the Turtle Movement in Omnia protects itself from the Corrupt Church by only meeting in small cells, in which everyone wears masks. Which is why the senior churchmen who are members don't know that every other senior churchman is a member as well.
 * The Man Who Was Thursday by G. K. Chesterton is about a
 * Let's Go to Golgotha by Garry Kilworth is about time travel tourism where one of the most popular trips is Christians travelling back in time to witness the Crucifixion. The tourists are disguised as Jewish citizens. In the end, the protagonist suddenly realizes that the crowd condemning Jesus to the cross is composed entirely of tourists from the future, and that no actual Jewish Jerusalemites of 33 A.D. are present at all.
 * Philip K. Dick wrote a story called The Eyes Have It where an Inspector Javert character who hunts aliens (indistinguishable from humans except for glow-in-the-dark eyes) and dissects them informs his superiors that there is an alien spy among them..
 * Harry Harrison's Bill the Galactic Hero had Bill getting recruited by an insurgency and then by military intelligence; eventually a bust occurs and every insurgent turns out to be (or at least says they're) working for the military.
 * One of Stanislaw Lem's Ijon Tichy stories from The Star Diaries has a planet full of agents disguised as robots trying to infiltrate an evil computer's  robotic army.
 * In Good Omens:
 * In Good Omens:


 * The novel Beach Music contains a dark take or two on this. In one case, Capers, a member of the main character's True Companions, joins an anti-Vietnam War student group with Shyla (another member of the nakama, and becoming her lover along the way) only to betray both the anti-war group and the nakama by having been an undercover agent the whole time. He tries to minimize the damage by saying that Shyla and the others were just innocent dupes, and the leader of the group was the real trouble. Turns out the group leader was also an agent.
 * Another case is something of an inversion. An undercover police officer tries to turn a peaceful student rally into a riot, but is caught and kicked out immediately because they realize he's much too zealous and dressed like too much of a stereotype to possibly be real.
 * In the Time Wars novel The Pimpernel Plot there's a scene where, apart from The Scarlet Pimpernel and his nemesis, everybody in the room turns out to be an undercover time traveller, with about half of them working for the villain and the other half there as backup for the heroes. (Possibly a bonus in-joke for readers familiar with the source novel: in the original version of the scene, apart from the Pimpernel and his nemesis, the room is empty.)
 * Friedrich Dürrenmatt's comedy/tragedy/drama The Physicists takes place in an asylum for Mad Scientists. As it turns out, however, none of the three eponymous physicists is actually insane:.
 * Tim Dorsey does this twice with his Florida Roadkill books. The first time, undercover agents of three different law enforcement agencies infiltrate a drug ring and try to bust each other (leading them to wonder if all drug dealers in Florida are secretly undercover cops). The second time, a group of people planning to overthrow Castro is composed almost entirely of agents of Cuban intelligence. The only exception is a retired CIA officer. The sad thing is that they all know it and yet they still make plots they have no intention of implementing and send reports back to Cuba about what was discussed in the meetings.
 * In Harry Harrison and Ant Skalandis's novel Deathworld vs. Filibusters, the Pyrrans have finally managed to defeat the pirates only to find out that Henry Morgan, pirates' leader, and several of his Number Twos were working for various agencies all this time, all under deep cover in order to expose the entire organization. The Pyrrans don't care and execute Morgan for all he has done (being an agent doesn't excuse murdering and pillaging).
 * In Harry Harrison and Ant Skalandis's novel Deathworld vs. Filibusters, the Pyrrans have finally managed to defeat the pirates only to find out that Henry Morgan, pirates' leader, and several of his Number Twos were working for various agencies all this time, all under deep cover in order to expose the entire organization. The Pyrrans don't care and execute Morgan for all he has done (being an agent doesn't excuse murdering and pillaging).

Live Action TV
""BERT?" "Ernie?""
 * In an episode of Cybill, Cybill dressed up as a prostitute to research an acting role she'd accepted. She asked another lady of the night what it was like being a prostitute, but it turned out she was also an actress. They asked a third woman, but she turned out to be a journalist. The three asked a fourth woman, but 'she' turned out to be a male vice squad officer.
 * In a really funny season opener of the short lived show The Agency, there was a bust of suspected terrorists, and it turned out it was all undercover cops from different agencies.
 * Saturday Night Live had a sketch called "Narc School" about a High School where every single student was really an undercover narcotics agent.
 * The Mary Tyler Moore Show had an episode where Mary and Rhoda join a dating club for divorced people despite being single rather than divorced. At the end of the episode, it turned out that everyone there was single and not divorced except for the club founder.
 * Law and Order SVU had the team attempt to infiltrate a pedophile "club" of sorts...only to discover that some other organization (FBI, most likely) was also setting up a sting operation. An exasperated Captain Cragen wonders aloud if this inability of the Good Guys to work together is why the Bad Guys keep staying ahead.
 * The Original Flavour Law and Order had a (lethal, naturally, considering this series) fallout from such an event during the 60s, where it turned out several supposed Communists/Hippie Protesters were actually cops and other agents spying on each other, and being purposely kept in the dark.
 * More hilariously, Reno 911 did this with a drug sting.
 * CSI also did this with gun runners.
 * NCIS, too, when Tony and Ziva acted as an assassin couple.
 * In an episode of Frasier, the son of a wealthy woman is trying to prevent Frasier from hitting her up for a donation (to save his old school, which is on the verge of bankruptcy). Niles distracts the son by saying one of the caterers at the party is trying to get her to finance a play. When the son asks out loud if any of the caterers are trying to get a play financed, they surprisingly all raise their hands.
 * There was an episode of Get Smart where Max becomes a Double Agent to infiltrate a KAOS cell, but it turned out everyone in the cell was from another agency (FBI, CIA, Naval Intelligence, & Scotland Yard).
 * An ep of Night Court had the FBI run a sting on a visiting judge using Dan as a shill, attempting to get Dan to catch the judge on tape trying to bribe Dan; turned out a different group of FBI agents was running a sting on Dan using the judge, trying to get Dan to take a bribe. Both groups of agents burst in, and recognize each other...


 * One sketch in Do Not Adjust Your Set has a very blatant policeman trying to infiltrate a criminal gang while they're planning a robbery. Eventually it turns that everyone there is a undercover agent of some sort. They decide to go along with the robbery anyway.
 * In the MacGyver episode "Honest Abe", Mac gets shanghaied by his CIA agent friend Abe to take down a South American dictator and a corrupt Army Major (played by Ben Stein) supplying the former with weapons. Eventually, one of the Major's lackeys reveals to the other he's a Federal agent seeking to bring down the Major... and the other lackey reveals he's one as well. And via background checks they discover that Abe is a CIA agent (they thought he had retired) and Mac is with the Phoenix Foundation. Naturally they are dumbfounded at the revelation that they are involved in an operation involving four secret agents of different agencies while they previously thought they were acting alone.
 * In a The Daily Show episode spoofing Chat Roulette's recent media attention, Jon decides to try it out. Besides the usual perverts, everybody Jon encounters is either a reporter or another Daily Show correspondent. When he gets to Katie Couric, she even complains that she is trying to do a piece on Chatroulette but so far she only got reporters.
 * Parodied on The Office, where every single member of a gun standoff turns out to be a double agent.

Music

 * Tom Lehrer introduced his song "The Wild West is Where I Want to Be" by saying, "A few years ago I worked for a while at the Los Alamos scientific laboratory in New Mexico. I had a job there as a spy. Now, I guess you know that the staff out there at that time was composed almost exclusively of spies... of one persuasion or another."
 * One of the vignettes in The Bonzo Dog Doo Dah Band's "Rhinocratic Oaths" sees a disguised police sergeant carrying out a sting operation at a gay bar (homosexuality being illegal in Britain before 1966), only to find that all the other patrons are policemen... who beat him up.

Newspaper Comics

 * The Trope Namer, even if it doesn't use those words in the caption, was a comic from The Far Side, where a wolf fashioned a crude sheep costume to infiltrate a flock of sheep that turned out to be comprised entirely of wolves in sheep costumes.
 * In another one, a guy is standing in a crowd of people in front of a mirror, yelling 'the vampires are everywhere', unaware that only he has a reflection.
 * In yet another, a stick insect hides in a bush...which is made of stick insects.

Tabletop & Other Games

 * In the Video Game Prototype2 Only Two of the higher ups in the evil genetics company and their partner evil hooded army enforcing martial law are not working for Evil Badass Alex Mercer. And then you assume the identity of one of them.
 * In Metal Gear Solid 2,
 * Mind you, Fortune was plotting to betray Solidus, who himself had anticipated her betrayal and was plotting to betray Dead Cell.
 * Occurs in Paranoia with The Industrial Workers of the World (Wobblies), introduced in the supplement Acute Paranoia (1986). When Friend Computer heard about this secret society, it sent Troubleshooters to infiltrate it and report back to Internal Security; however, since the Real Life Wobblies fell apart before Alpha Complex was created, they were executed for failing to find it. After several iterations, one clever team created the Wooblies so they'd have something to "infiltrate". At first, every single member was an IntSec spy, but later they started finding "real" members of the society... who were actually spies from other secret societies.
 * Paranoia in general lives on this trope. The PCs are charged by The Computer to hunt down mutants and secret society members. Every PC is both a mutant and a secret society member.
 * It's standard practice for many live-action roleplay events, such as dinner-theater murder mysteries, to assign everyone a hidden agenda and/or a motive to kill the designated victim.

Webcomics
"Shapeshifter: Well, now I just feel like an idiot."
 * Happened in the first Spying With Lana storyline when the good guys kept getting meaningless assignments. (NSFW). The one in the story was actually a plot by the chief to fish out the double agent behind it.
 * One of Khrima's plans in Adventurers!!
 * One strip of Oglaf (warning, rest of comic is very NSFW.)


 * Darths and Droids has an noncanon outtake strip in which Jim gets paranoid after encounters with shapeshifters and clones and says that anyone could be a shapeshifter clone. At which point the entire Jedi Council confess to being shapeshifting clones.

Web Original

 * This article from The Onion. Conversely, they also once made a reference to a child porn site being busted by authorities, and every single visitor to the site claimed to be a concerned citizen trying to infiltrate the site and bring it down from the inside.
 * The premise of this College Humor sketch.

Western Animation

 * In an episode of The Simpsons, Bart went to an auction to mess with the bids. When he won, he snickered and bolted for the door. At which point the auctioneer awarded it to the second highest bidder... who also snickered and bolted for the door. It is revealed that no one placed a serious bid for that item.
 * Another episode had Lisa pretend to be part Native American. When she confesses her fraud during a Native American conference, almost everyone there reveals they were faking their ancestry as well, including one guy who was two dwarfs in a raincoat for some reason. Except that
 * In The Venture Brothers episode "Blood of the Father, Heart of Steel" Brock is sneaking into a building through the air ducts when he sees another guy doing the same thing.
 * The Dog City episode "Disobedience School" had Bugsy Vile taking over the school and trying to turn the students into delinquents. After the climax, all students in his class turned out to be infiltrators from various police agencies.
 * On Duckman, a televangelist hosted a forum of other religious figures, who at the end were revealed to be fakes - except for the Ayatollah, who just wanted to improve his image in the states.
 * In SpongeBob SquarePants, Squidward and SpongeBob enter a dance contest together, with Squidward inside SpongeBob doing all the dancing. When they are found out and disqualified, all the other contestants reveal that they too had help. The prize went to the only one who danced on his own: Patrick, who was actually rolling on the floor because of a cramp.
 * Similarly, Spongebob once tried to disguise as Mister Krabs when he molted his shell so he wouldn't look like a sissy in front of his old buddies; once Mister Krabs makes his confession, the others all reveal that they, too, had something to hide.
 * In an episode of The Adventures of Jimmy Neutron, a picnic is accompanied by a series of parent-child games. Jimmy, who naturally despairs of Hugh winning anything unassisted, invents something that more or less instills hypercompetence in athletics. When Cindy wins after the device malfunctions, it's revealed that her "mother" is actually her bodybuilding aunt, which would mean the prize went to the Neutrons - except that they fess up to cheating as well, at which point the presenter runs through every team present until near-terminally unathletic Carl and his father are revealed to be the only ones who haven't cheated in at least one of the events.

Real Life

 * Depressingly enough, this has been Truth in Television at times. There's more than one incident on record where the "crooks" caught by a sting operation turn out to be officers running a sting for some other agency.
 * Cops busting undercover cops is also done deliberately at times, to justify bringing a deep-cover asset out without blowing the asset's cover. So far as the crooks are concerned, their trusted colleague has merely been arrested and jailed.
 * Image Boards like 4chan, which usually consists of Trolls trolling Trolls.
 * 4chan is so well known for its trolls, that some have become regular entertainment. The trolls, who feel they're losing their edge, mix it up a bit by trolling the other forum-goers by either being an incredibly obvious troll or simply not trolling. This enrages the others, since they have come to expect trolling, and aren't quite used to trolls who troll by not trolling. And now the word "troll" has lost all meaning to you.
 * Famously, during the McCarthy era in the USA, the FBI had many of its members infiltrate the American Communist Party. It was estimated that, at its peak, approximately two-thirds of the American Communist Party consisted of operatives on the FBI payroll.
 * Conservapedia. Trying to separate the trolls from the genuine maniacs is a Mind Screw of a task, not helped by the fact that people are judged there mostly by how much they suck up to the site's Small Name, Big Ego founder.
 * Tales abound of Agent Provocateurs infiltrating student political societies in the US only to find that the most radical elements are agents from a different source and all the actual students are perfectly reasonable and unobjectionable people.
 * Supposedly when the Allies got hold of Nazi records at the end of World War II, they learned that every German spy in Britain had been found and turned into a double agent by Allied intelligence.
 * Check "Double Cross System" in that other wiki over there. It was the most brilliant tour-de-force of British intelligence: They managed to find out and turn every single German agent that the Germans sent to Britain during the whole war. The head of the "Double Cross System", John C. Masterman, estimated that, by 1941, the MI 5 actively ran and controlled the German espionage system in the United Kingdom. And he was right.
 * Of course, the head of the Abwehr, Admiral Canaris, was deliberately sabotaging Nazi intelligence operations from the inside and feeding British Intelligence information at the time.
 * The classic shell game scam will often feature a crowd of what appear to be pedestrians, taking interest in a supposedly legitimate game of chance. The odds are that everyone in that crowd except for you (the mark) are in on the scam.
 * It is said that the only reason the Ku Klux Klan is still around is the undercover police agents -- they're the only members who reliably show up for meetings and pay their dues on time.
 * A sad case seems to be the german extreme right-wing party NPD (Nationaldemokratische Partei Deutschlands, National-democratic Party of Germany, yeah, there still are those around, too). They are infiltrated heavily by the Verfassungsschutz (Protectors of the Constitution, Germany's domestic intelligence agency). How heavily, you ask? When talking about disbanding the party, the highest court ruled that with so many protectors in the party - which would all be exempt from prosecution - any abolishment trial would be doomed to fail.
 * The saddest thing about this? It seems that many of these planted moles are using their immunity and the paycheck from the Verfassungsschutz to actually help the party to survive. In one case, a high member of the NPD stated openly that without being paid from the Verfassungsschutz, he wouldn't have been able to build up the party's branch in his state.
 * In the former East Germany, the Stasi made generous use of informers in the population to spy on antigovernment forces. So many, in fact, that the BBC reported that as many as one in seven East Germans were on the Stasi's payroll.
 * In late 2013, it was revealed by Edward Snowden that the NSA has infiltrated a number of MMORPGs including World of Warcraft and Second Life -- and had deployed so many agents to look for terrorists hiding as orcs that they had to create a "clearinghouse" of sorts to make sure they weren't spying on each other.