Sometimes, the worst thing about being The Mole is not the life-threatening lifestyle, the risk of getting caught by the enemy, being outed as a spy and being executed before you can complete your mission. No, sometimes, the worst part is the chance of coming under-fire by your own allies. That one loose cannon who wasn't informed of your mission, believes you've turned traitor, feels there's only one way to deal with scum like you, and in an impulsive act of what they think is patriotism, shoots you on the spot.
Unlike HeelFace Door-Slam, the character was Good All Along, and ends up getting attacked for a misunderstanding. The attacker is likely to undergo My God, What Have I Done? after learning that the guy was a Fake Defector. For extra irony, the mole was probably bringing in big enemy secrets and the attacker got to him before he could give the intel.
If there is Dramatic Irony involved and the audience knows that the victim is a mole, it can make the misguided patriot look unreasonable and monstrous. To make the situation worse, the mole might try to explain the situation, only for the attacker to refuse to listen/believe him until it is too late. If the rest of the mole's allies arrive in time to save him, that leads into He's a Friend. The attacker is likely to get You Fool! and What the Hell, Hero? for his actions, or inversely the attacker will dish it out to the people that didn't tell him the guy was a mole. Even worse still if the mole does their mole thing by their own without telling any of their allies, causing all of them to believe that you've turned traitor and thus will hardly trust your words but sometimes this is intentional on their part, and they may even expect to get attacked by their own (real) allies.
Please note that the attack doesn't have to be fatal. The mole can be put into a coma, badly incapacitated, or even end up having his cover being blown because of the attacker, anything that puts a serious crimp in his mission, perhaps even render it All for Nothing.
A subtrope of Nice Job Breaking It, Hero and Right Hand Versus Left Hand. Similar to Acquitted Too Late where an innocent person dies in prison before their exoneration. Compare and contrast Flock of Wolves and Friend or Foe where one didn't know that the mole was on their side in the first place. Can go hand in hand with Vigilante Execution, especially if the executioner isn't popular with the rest of your side. If the mole went undercover by orchestrating his own death, see Mistaken for Own Murderer. See also Tragic Mistake and A Tragedy of Impulsiveness.
- In Episode 10 of Kabaneri of the Iron Fortress, the cast is shown to have been captured by the villains, with one of the characters having performed a FaceHeel Turn. Most of the cast believed the betrayal was genuine, due to his previous status as the Aloof Ally. So when the prisoners finally retaliate, the "traitor" is also attacked. It's up to the main character to intervene and explain that the "traitor" had spent the entire time passing him information about the villain's lair.
- In the manga adaptation of Mega Man X, X believes that Storm Eagle had betrayed him and ended up giving him a No-Holds-Barred Beatdown. It's only after X has fatally wounded him does Zero tell him where Storm Eagle's allegiances truly lie.
- Blake and Mortimer: A young Henry Blake unknowingly participates in the removal of his childhood hero Colonel Lawrence (better known as Lawrence Of Arabia) after he's seen talking with known fascists. It's made to look like an accidental crash under the guidance of the senior MI6 agent Lawless who decided Murder Is the Best Solution for dealing with traitors (and with considerable relish, because he'd always resented Lawrence). It turns out Lawrence was infiltrating them on orders from MI6. Oops.
- In Power Rangers: Soul of the Dragon Tommy hunts for his missing son, JJ, and ends up him having joined an alien gang, and end up coming to blows. It's only later that Tommy learns that JJ was infiltrating the gang on the behalf of his superiors of SPD. Not that it matters, as JJ ends up the target of the gang's leader, the long-missing Scorpina, as JJ is chosen to be the sacrifice to bring Lokar to Earth.
- Hard Boiled, Inspector Yuen tries to kill a high profile mob hitman, Alan, but runs out of bullets, and only later learns from his superiors that Alan is actually an undercover cop himself.
- Punisher: War Zone: During a firefight between the Punisher and Billy Russotti's henchmen, Castle mistakenly kills Nicky Donatelli, an undercover FBI agent. He's haunted by guilt for most of the movie and attempts to make reparations to Donatelli's widowed wife, Angela, and daughter, Grace.
- In Team America: World Police, Gary, the newest member of the counterintelligence team, goes undercover to try to uncover the terrorist plot. While undercover, his teammates mistake him for a an actual terrorist despite his Paper-Thin Disguise and nearly kill him during a Chase Scene.
- In Face/Off, Sean Archer undergoes plastic surgery to assume the appearance and identity of Castor Troy. Due to some security lapses, Castor ends up forcing the surgeons to give him Archer's face and identity. Because Castor destroyed all the evidence of the switch, Archer's own FBI colleagues have no idea that he's now impersonating Castor. Castor is able to use this to his advantage as he leads an all-out raid on his former girlfriend and her brother while Archer is holed up with them and trying to get their help.
- In the climax of Harry Potter and the Deathly Hallows, Professor McGonagall and the rest of the teachers are done putting up with Snape and join forces to drive him out of the castle. It's shortly after he dies does Harry learn he had long been Dumbledore's inside man, with even Snape's murder of Dumbledore having been arranged between the two, and that he had actually used his position as Hogwarts' headmaster to protect everyone from the Death Eaters. As such, by driving him out, there is no one to shield them from Voldemort, who decides to launch an all-out war against the castle.
- In season 3 of 24, Gael Ortega goes undercover alongside Jack Bauer in the Salazars operation. Unfortunately, Gael ends up getting arrested by CTU and it's only after they brutally interrogate him do they learn their mistake.
- Nearly happens retrospectively to Felix Gaeta in Battlestar Galactica (2003), when a semi-tolerated vigilante group who have been executing Cylon collaborators following the humans' escape from New Caprica nearly kill him because of his role as chief assistant to President Baltar under the occupation. In fact he was an anonymous mole for the resistance, not even his contacts knew who he was but the information he passed on saved tons of lives (including the soon-to-be restored President Roslin). Until he's rescued, Gaeta makes no attempt to defend himself, seemingly because he hates himself for the horrors that he had to be complicit in to maintain his cover.
- In one episode of Hogan's Heroes, Carter pretends to turn traitor in order to learn the location of a chemical plant. In a unique variation, a member on the enemy side that wanted to defect tried to poison Carter because she thought his act was real.
- In Buzz Lightyear of Star Command episode "Shiv Katall", when one of Zurg's brain pods defects, he sends for the titular assassin to eliminate the brain pod. Hearing this, Buzz goes off on the mission alone. Feeling Buzz needs help, Mira drags Booster and a reluctant XR on a search for Shiv. While chasing Shiv's ship into Zurg's territory, Mira rams it with their star cruiser, at the cost of destroying its power source. It's only then when they're stranded on a planet with Shiv does Mira find out that Shiv was actually Buzz, who used the persona to secretly save those who defect from Zurg's empire. As a result of Mira blowing his cover, they need to come up with a new way to ferry dissidents.
- Star Wars: The Clone Wars: In season 4's "Deception" arc, Anakin becomes obsessed with finding and killing a bounty hunter who supposedly killed Obi-Wan, unaware that the incident was staged and Obi-Wan has now gone undercover as his alleged killer among a group of bounty hunters involved in a plan to assassinate the Chancellor. Afterwards, Palpatine uses the fact that Anakin wasn't informed of the plan as an opportunity to sow more distrust between him and the Jedi.
- Young Justice: Miss Martian Mind Rapes Aqualad and destroys his mind as revenge for his murder of Artemis, leaving him catatonic. Turns out Artemis' death was faked and she's acting as The Mole alongside Aqualad. Miss Martian finds out as she's destroying his mind and is horrified afterward. To twist the by knife even further, an unaware Beast Boy applauded her for her actions.