In mad science, "malfunction" does not mean fried circuits and broken equipment (sometimes) but often it turns out that a malfunction has created something wondrous. Usually there is no explanation to how a "malfunction" can make modifications that seem intelligent, and no mention to where it gets the parts for a technology that is entirely different from the intended. For example a toaster can easily become a time machine through Miraculous Malfunction.
This can be used as an Achievement In Ignorance for the Bungling Inventor (most of whose works are created in this manner). It can also serve as an alternative explanation to why there are No Plans, No Prototype, No Backup: it's not that the technology was lost but rather, the individual sample was a result of a one-time event that cannot be recreated. Particularly good researchers might then learn to reverse engineer this piece to create more, but usually they will be just as dumbfounded about how it works as everyone else even if they themselves have created it. Surpringly such technology will usually be surprisingly stable and not at all prone to Phlebotinum Breakdown, unless the plot suddenly calls for it. Note, that because of the poorly understood nature of such technology it can unexpectedly become dangerous.
(While there are real-world examples of inventors accidentally stumbling upon new things while researching something else, the fictional inventor will never need to bother with follow-up research: they will get the new tech from it ready-made.)
- In Ghost in the Shell: Stand Alone Complex the tachikomas become sapient due to an imperfection on one of their circuit boards caused by Bateau giving his "personal" tachikoma natural oil which corroded part of it. This tachikoma induced sapience in the others when their AI's were synchronized. They did try that with the fujikomas, yet that did not work. They never quite figured the reason out.
- The material that became Captain America's circular shield was created accidentally during an experiment to merge vibranium and an iron alloy. An unknown catalyst entered the mixture while the scientist overseeing it was asleep.
- In Cloudy with a Chance of Meatballs, Flint hooks up his machine to the town's power station to give it enough electricity to create food from water. Instead, the extra power makes the machine take off like a rocket and start orbiting in the lower stratosphere, creating food that comes down in showers using moisture from the clouds. Later, being overworked makes the machine start overmutating the food and it eventually gains sentience.
- Short Circuit: a robot is struck by lightning which causes a "malfunction" that gives it sentience.
- Happens in the 1984 film Electric Dreams: the hero, Miles, spills champagne on his PC while it is plugged into his company's megacomputer, causing his computer (of course!) to come to life.
- Honey, I Shrunk the Kids: a stray baseball landing on the shrinking machine is what actually makes it work. Though Wayne Szalinski is able to figure out why the baseball made the machine functional, and replicate the results.
- In Inspector Gadget 2, G2 swaps control chips with Gadget. Because of this, she gets some of his "glitches," which come with some fairly absurd side-effects. For example, her hat-mounted "boomerang gun" turns into a cartoon mallet, and her "net guns" turn into flying drones armed with rolls of wrapping paper. Just...don't ask.
- Dirk Gently's Holistic Detective Agency—Professor Chronotis' time machine seems to be in a strange relationship with the telephone system. After he has his phone repaired, the time machine is inoperable too.
- Isaac Asimov's stories have several examples of unusual robots coming into being via a Miraculous Malfunction:
- In the Lije Bailey series, the psychic robot, Giskard, is created this way.
- "Robot AL-76 Goes Astray" has the robot of the title managing to create a mountain destroying mining laser that runs on two D-batteries after being exposed to unexpected stimuli when lost on Earth.
- In "Liar!", a robot became psychic due to an error when they were building the brain. Nobody could figure out how it happened; the robot knew but couldn't tell because of the First Law: it would hurt the human engineers to know that a robot knew something they didn't.
- "Light Verse" has a malfunction makes a robot hopeless at housework, but somehow, able to create incredible art. Until a well-intentioned visitor has it repaired, after which they can never get that talent back.
- It's noted in "The Bicentennial Man" that Andrew was the result of a production error. US Robots tightens their controls as a result to prevent it happening again since expressive robots who want to be human are bad for business.
- The Strange Case of Dr. Jekyll and Mr. Hyde: An impurity of salt is what makes the transformation from Dr. Jekyll into Mr. Hyde possible.
- In Memoirs of an Invisible Man, it's implied that someone spilling a cup of coffee on a control panel resulted in uncontrolled but permanent invisibility, in a lab whose research had nothing to do with invisibility.
- In the Discworld books, this is the best case scenario of allowing Bloody Stupid Johnson to build anything. Case in point: his "improved manicure device" is best used for peeling potatoes.
- In Murray Leinster's short story "A Logic Name Joe" a flaw in the wiring of the titular Logic (essential search engine terminals) somehow gives it the compulsion and ability to find a perfect, easy, workable answer to any query asked of him, even if it involves breaking the law or violating the laws of physics. Such queries include how to easily build a perfect counterfeiting machine, commit the perfect murder, pull off the perfect bank robbery, mix a fast, effective hangover cure that eliminates all traces of having been drunk, build a perpetual motion machine, and (in the case of The Protagonist's Stalker with a Crush ex-girlfriend) find the exact location of someone who doesn't want you to find them. Oh, and it also makes Joe override the entire network, so any query asked of any Logic automatically goes to Joe instead.
- A darker example occurs in one of the vignettes in Arthur Machen's The Three Impostors (specifically, The Novel of the White Powder), where a character's antidepressant prescription is accidentally filled from an expired batch of the drug that (thanks to unknown environmental conditions) has randomly degraded to the point of being chemically identical to Vinum Sabbati, the wine of the witch's sabbath (which isn't wine so much as a sort of horrifying eldritch version of ecstasy that temporarily converts the taker into a Humanoid Abomination). Since the prescribed dosage of antidepressant is several orders of magnitude larger (and much more frequent) than the amount of ''Vinum Sabbati'' offered at a Witch's Sabbath, Body Horror ensues, and the unfortunate victim is eventually reduced to a permanent mucous stain (but not actually killed).
- In Star Wars: Kenobi, Annileen Calwell's husband Dannar fiddled with a vaporator at their store once, and it began producing water so incredibly sweet and delicious that the farmers are afraid to ever touch the settings again, but that means they have trouble replicating the results. Their friend and business partner Orrin Gault has come close and is attempting to ramp up production (he considers it an exquisite irony that the desert planet might export water), but nothing can match Old Number One. And then the Tuskens smash the control panel to bits during their raid on the Claim, destroying the formula forever. Orrin's copycat vaporators somehow stop producing the sweetwater themselves after that, worsening his cashflow problem.
- In Red Dwarf episode 'Lemons', the crew tries to assemble a "rejuvenation shower" from flat pack. They don't use all the parts, and the finished shower looks decidedly wonky. Rather than simply not working, the shower - which is simply meant to rejuvenate the bather - transports them through time and space to Earth in the year 23 AD.
- Genius: The Transgression does not make use of this trope, curiously; rather, any new technological piece created by a genius is one-of-a-kind called a Wonder. Normals can cause breakdowns, but it stays on the "tweaking the original" level.
- Invoked in an episode of Adventures of Sonic the Hedgehog, where Robotnik explicitly says that the creation of his "Super-Genius Program" was a million-to-one shot - and after the program is stolen and he orders his computer to make it again, the computer has to remind him of exactly this fact (which he said himself not five minutes before!).
- In "Time and Punishment," a Treehouse of Horror on The Simpsons, Homer's attempts to repair the toaster create a time-machine that sends him back to the Mesozoic. As soon as the toaster "pops," he returns to the 20th century, but that's enough time to totally alter the history and evolution of all life on Earth by swatting a bug.
- R.W Wood noticed that a heating circuit is broken, but a wire in a glass with atomic hydrogen not only doesn't cool, but in fact is white hot. This provoked some useful research on recombination and the invention of atomic-hydrogen welding.
- Iodine was discovered completely by accident as a byproduct of adding too much sulfuric acid to the waste left over after making saltpeter (a component of gunpowder) from seaweed. After the initial fight over who had discovered the new element, there came the question of what to do with it. It dyed and stained things well, but didn't smell too good, so it was given to soldiers to use to mark the wounds of those who had been shot, stabbed, etc. in battle. Surgeons of the period quickly noticed that soldiers whose wounds had been marked by iodine were far less prone to infection.
- Teflon was invented when an organo-fluoride gas was left in a cylinder a long time and solidified by itself.
- The microwave oven was invented when engineers working on a radar project realized that working in the same room as the radar when it was running caused the candy in their pockets to melt. This is why the original name of the microwave was the Radarange.
- Engineers at 3M were not initially happy to discover their efforts at making an improved adhesive were weak enough to be pulled away by hand. Then one of them, tired of having the bookmarks in his church hymnal fall out, added some of the weak adhesive to it. And that's why we have Post-It Notes.
- The antibiotic Penicillin was discovered when Alexander Fleming found his bacterial samples contaminated by Penicillium mould and studied the way the mould was able to create bacteria-free areas on his petri dish.
- While software developers joke "it's not a bug, it's a feature!", sometimes those bugs do become features in later releases as seen in Ascended Glitch. Note that for all intents and purposes, a bug is an unintentional error in the implementation of the software.