The lead character has just successfully carried out their tricky infiltration of some high-security facility and copied the information/stolen the technology/rescued the prisoner/what-have-you. Just as they're done, in wanders some random security guard, who sounds the alarm. Cue the action sequence.
Basically it's a way for a Spy Drama to have its cake and eat it too. You want to see a perfectly-executed piece of espionage, but you also want to see the lead kicking and shooting and fleeing? Throw in some nicely-timed security personnel and you can have it both ways. Although sometimes you have to wonder, did the question "What do we do about the security patrol?" never even come up during planning? In Spy Fiction, the fact that the enemy would quickly realise that their secret files had been stolen also rarely seems to come up.
Otherwise, this trope is something of an example of Truth in Television. It is surprising how many crimes are stopped because police or security forces happened to show up at just the wrong time for the criminals, or someone saw something and called the police.
- Mai-HiME, although it's subverted in two ways: first, Mikoto triggers the alarm before Mai and Natsuki even manage to get into the (abandoned) facility, and second, when the guards arrive just as the girls are leaving, Mai persuades the other two to surrender despite their readiness to fight. They later escape anyway, with the help of a conveniently-timed ambush.
- Masses to Masses: Just as Ian finishes the infiltration to seize illegal organs, one random guard manages to sneak up on him and is about to get help. Instead, gets a punch to the face.
- Escape from Sobibór: One of the guards goes into a senior officers office and discovers him by spotting blood and following its trail, marking the turning point of the escape when they had previously gotten along without widespread discovery
- In Who Am I, the hero breaks into the university to get hold of the exam questions. Upon completing the data download in the server room, a guard appears out of nowhere. Busted!
- This happens in the prologue of Copycat when Sigourney Weaver's character is attacked by a serial killer, who is stopped by a policeman that he hadn't anticipated. The main villain of the movie, who copies famous crimes, leaves a motion detector to cover the corridor so he won't be taken by surprise like his predecessor.
- This trope is particularly favoured by Alias, which does it almost Once an Episode.
- Happens on occasion in Burn Notice, usually to the delight of the 'narrator' who always has good ideas on how to effectively deal with such a predicament.
- Happens in an episode of Firefly. Jubal Early meticulously maps out the crew and waits to break into the ship until after everyone is in bed or otherwise isolated and vulnerable. He then enters the airlock, turns a corner...and bumps right into Mal.
- Shadowmaster Chronicles parodies and subverts it.
Hay Lin: Why not just take out a guard and blend in?Dakota: Because that's stupid. The point of espionage is to NOT BE NOTICED BY ANYONE. What if that guard had buddies? Or was invited to play poker or something?
- Thief (2014) You can walk around undetected for most of the levels and then after reaching your primary goal someone spots you to add some tension to the level.
- The Thief Taker General is really good at this. In the Prologue, you are spotted by the Thief Taker General on the roof during the ceremony. In Chapter 2, as soon as you break the vault and get the ring you came for, the Thief Taker General comes through the door. He will come after you both in the Keep's vault and when stealing the Primal Shard on the Baron's Mansion, though he shows signs of expecting you.
- In Chapter 3, the guards discover that you used the secret passage in the House of Blossoms just after you get the book you came for.
- In Chapter 4, the guard barges through the door the instant you get the Keep's blueprints.
- This is why there's always an element of luck to playing a Spy in Team Fortress 2. You can put on a flawless disguise so that the opposing team doesn't give you a second glance as you slip past them, you can plan your infiltration route through back passages and rarely-used hallways, and then you turn a corner and blunder into some noob who's gotten lost in his own base.
- The sole programmed Jump Scare in Bioshock Infinite takes this form in Comstock House, where you have to silently manveuver through undetected by the Boys of Silence, who screech horribly if they find you, signaling Mooks to go after you. Upon reaching a security console to open a locked door, you pull the lever, watch as the door opens on the security feed, turn around then an unavoidable Boy of Silence screams standing right behind you. Note that it is nowhere in the room before switching off the security, and it is completely unavoidable.
- Red vs. Blue: In the second episode of Season 9, when the guard catches South stealing data from the terminal.