"Bad Dreams Are Made of This" is the 12th episode of the second season of Inspector Gadget.
Recently, the Gadget clan seems to have nightmares, such as Gadget losing control of his gadgets, Penny losing her computer book to the M.A.D. agents, and Brain being chased by a giant M.A.D. Cat. It turns out that they're not the only ones who have nightmares as the townspeople of Metro City also seem to have nightmares. It is the evil work of Dr. Spectrum again, who has invented a machine capable of generating nightmare-inducing rays, which are being surreptitiously propagated throughout the night through the local TV station's antenna. With the entire city too sleepy to function during the day, it becomes ripe for looting by Claw's agents. Spectrum and his henchmen are also manufacturing a "dream-away" gizmo at the TV station to exploitatively sell to the nightmare-plagued populace from M.A.D.'s own profit. Quimby assigns the sleep-deprived Gadget to figure out the cause of the nightmares.
With Brain in tow, Gadget goes to the TV station. There, Spectrum and his henchmen send out killer robots to finish Gadget off, but Gadget's own clumsiness and Brain's interference put a stop to it. Gadget is eventually captured by Spectrum and wired to the machine. While having another nightmare, Gadget goes out of control with his gadgets, making the machine overheat and explode. While Spectrum escapes again, Quimby arrives to congratulate Gadget on another job well done.