In [[MadScientist mad science]], "malfunction" does not mean fried circuits and [[GoingCritical broken equipment]] ([[PhlebotinumBreakdown 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 [[AchievementsInIgnorance Achievement In Ignorance]] for the BunglingInventor (most of whose works are created in this manner). It can also serve as an alternative explanation to why there are NoPlansNoPrototypeNoBackup: 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 PhlebotinumBreakdown, 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.)

Sister trope to FreakLabAccident which [[SuperHero gives people powers]] rather than creating and changing technological pieces. See also InstantAIJustAddWater.

----
!!Examples:

[[AC:{{Anime}} and {{Manga}}]]
* In ''Anime/GhostInTheShellStandAloneComplex'' the tachikomas [[spoiler: become sapient due to an imperfection on one of their circuit boards caused by Bateau giving his "personal" takioma 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.

[[AC:ComicBooks]]
* The material that became CaptainAmerica'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.

[[AC:{{Film}}]]
* ''Film/ShortCircuit'': a robot is [[LightningCanDoAnything struck by lightning]] which causes a "malfunction" that gives it sentience.
* Happens in the 1984 film ''ElectricDreams'': the hero, Miles, spills champagne on his PC while it is plugged into his company's megacomputer, causing his computer (of course!) [[InstantAIJustAddWater to come to life]].
* ''Film/HoneyIShrunkTheKids'': 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 ''Film/InspectorGadget 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''. [[MST3KMantra Just...don't ask.]]

[[AC:{{Literature}}]]
* ''DirkGentlysHolisticDetectiveAgency'' - 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.
* Creator/IsaacAsimov'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. [[spoiler: 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.
* ''Literature/TheStrangeCaseOfDrJekyllAndMrHyde'': An impurity of salt is what makes the transformation from Dr. Jekyll into Mr. Hyde possible.
* In ''Literature/MemoirsOfAnInvisibleMan'', 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 Literature/{{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 ''[[BeyondTheImpossible 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, [[ArsonMurderAndJaywalking mix a fast, effective hangover cure that eliminates all traces of having been drunk]], build a perpetual motion machine, and (in the case of TheProtagonist's StalkerWithACrush 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.

[[AC:Live Action TV]]
* In ''Series/RedDwarf'' 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.

[[AC:TabletopGames]]
* ''TabletopGame/GeniusTheTransgression'' 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.

[[AC:WesternAnimation]]
* In ''CloudyWithAChanceOfMeatballs'', 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 [[PhlebotinumBreakdown overworked]] makes the machine start overmutating the food and it eventually [[InstantAIJustAddWater gains sentience]].
* Invoked in an episode of ''TheAdventuresOfSonicTheHedgehog'', 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 TreehouseOfHorror on ''WesternAnimation/TheSimpsons'', 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 [[ButterflyOfDoom by swatting a bug]].

[[AC:RealLife]]
* R.W.Wood in one experiment 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.
----