In The ABC Murders, Hercule Poirot says his ideal mystery would be murder at a bridge game, where everyone was so intent upon the game that no one noticed when one of them, the dummy that round, got up and killed the host. A few books later, he faces exactly that.
In Airframe, after a strange incident involving a plane, the manufacturer takes it up to recreate it, and a reporter that's been following them demands to go along. She winds up regretting it.
In the first book of Animorphs, Tobias states he's all right with his red-tailed hawk morph and doesn't want to be anything else. Consequently, the end of that episode (and the whole rest of the series) sees him trapped in that shape.
As John Galt explains towards the end of Atlas Shrugged, society has claimed for decades that wealthy businessmen, executives, and entrepreneurs are evil villains who harm, exploit, and enslave others. Well, he has made them all vanish, liberating society of their evil... so what does anyone have to complain about?
"Be Careful What You Wish For" by Stef already states it in the title. Young girl Gwen is bored and wishes for something to do. She is sent on a quest to save Idlebury Kingdom... from itself.
In The Book of Lost Things a greedy and gluttonous man requests that the Crooked Man pay him in gold the weight of everything that he has eaten at a buffet. The Crooked Man complies...by pouring molten gold down his throat.
A very sad example happens in Bridge to Terabithia. In the beginning, Jess want to become the fastest runner in his grade, but he is beaten by Leslie. Near the end, he contemplates that now he probably is the fastest runner — because Leslie, who became his best friend during the year, has just died in a tragic accident. Needlessly to say, this wish fulfillment doesn't make him happy.
A Brother's Price: Two women standing outside a building in which their sisters and their husband are. One says to the other: "I wish he was dead" ... the building explodes. Their husband dies, but so does everyone else. They both suffer from survivor's guilt, but it is clear the explosion wasn't supernatural. In fact, it was the horrible husband being Hoist by His Own Petard, he had intended to survive, but was Too Dumb to Live.
Charlie and the Chocolate Factory: Seemingly every child on planet wants to get one of the five Golden Tickets, which will enable him or her to visit Willy Wonka's factory. For four out of five children who find it — and of these four, at least three actively seek the ticket — the visit turns into a horrible experience. All four are too self-centered to follow their guide's instructions; when faced with something they realize they want badly, they disregard his warnings and pursue it to dreadful ends. This is subverted with The Hero, a virtuous, unselfish kid who becomes the heir to the factory.
John Collier's short story "The Chaser" applies the principle to a Love Potion. The customer buys it in order to secure the absolute and undying love of the woman he desires, but it's implied that this will eventually grate on him. In fact the chaser of the title is the untraceable poison the shopkeeper is sure he'll be back to purchase. The story was adapted as an episode of The Twilight Zone (1959), and more gruesomely as a Tales from the Cryptstory and episode, "Loved To Death!"
In The Chocolate Touch, John wishes that he could eat all the chocolate he wanted after his parents cut him off. He goes to a candy store that he'd never seen before and buys a box of chocolates, which he eats before going to sleep that night, and discovers the next morning that everything he touches with his lips turns to chocolate. He's ecstatic at first... until he starts experiencing the downside.
In The Chronicles of Thomas Covenant: The Land, drinking the Blood of the Earth gives the power to command absolutely anything to happen, but limited human minds simply cannot know all consequences of a sudden change to reality. So it's usually safest not to use it.
The City of Brass: Invoked by the ifrit, who give enslaved djinn to humans with the full expectation that they'll go Drunk with Power, cause tremendous harm, and eventually get themselves killed or ruined with a poorly-worded wish.
A principal point in the novel Coraline by Neil Gaiman — even used as a tagline in the film. Coraline wants her life to be more interesting, exciting, and engaging... she gets it, but not the way she wants.
Ista: The gods' most savage curses come to us as answers to our own prayers. Prayer is a dangerous business.
This echoes a remark by the Roman writer Juvenal about "monstrous prayers that Heaven in anger grants."
In Death Star, Imperial gunner Tenn Graneet, after Alderaan, remembers his grandfather's saying about being careful what you wish for.
Now he understood exactly what that meant. He had wanted to fire the big gun, and he had gotten to do just that. The only man in the galaxy who had shot it for real, at real targets, and look what it had brought him: misery beyondhisugliest dreams.
Unstated, but in Galaxy of Fear: The Doomsday Ship Zak Arranda, tired from ten books of constant adventure and hazard, just wants to stop and have nothing to do for a while. In the next book, Clones, the family has been on Dantooine for two weeks traveling with a local tribe with anything dangerous being quickly and easily resolved by the adults, and the tech-minded Zak is bored out of his mind.
A running theme in the Tiffany Aching series (the young adult Discworld books):
In The Wee Free Men, Tiffany's baby brother is stolen by the Queen of the Fairies, who will give him whatever he wants — and since he wants sweets, he'll get sweets, and nothing else, for the rest of his life.
That's not even the main problem. He can get as many sweets as he wants and his imagination is a limit... but since he is a little boy, every sweet he is going to eat now means that there is a better sweet in the future he can imagine that he is not eating right now. The end result is a crying boy surrounded by an ever-growing pile of sweets, unable to choose a single one because there is always a better one just beyond his reach.
Tiffany's dream of entering a magical world (the witch school) gets sort of answered by having to visit the nightmarish Fairyland.
In the third book in the series, Wintersmith, Tiffany doesn't want the titular Anthropomorphic Personification of Winter to continue making her name in frost, or icebergs that look like her, but feels sorry and lets him make all the snowflake portraits of her that he wishes. As the story opens with a Flash Forward of the entire Chalk covered in tens of feet of snow, you can see where this is going.
In A Hat Full of Sky, this trope is explicitly dissected, with Granny Weatherwax pointing out that if someone in a story gets three wishes, the third will always be "undo the harm caused by the first two wishes". And in the beginning of the book it's noted that had Tiffany said aloud that she'd like to marry a prince, the Feegles might well show up at her door with an (unconscious) prince and a (tied up) priest ready to perform the ceremony.
There's an example in the main series as well: in Eric, the titular character demands three wishes from Rincewind the wizzard [sic]: mastery over the kingdoms of the world; to meet the most beautiful woman who ever lived; and to live forever. Oh, and a chest of gold. The first wish (granted by Vassenegothrough Rincewind) sends them in orbit above the Disc, and then to one of Eric's new dominions for tribute (the Tezuman empire, the inhabitants of which want to sacrifice them for being a bad landlord, metaphorically speaking). The second wish takes them to the Tsortean Wars, where they meet Elenor of Tsort (an Expy of Helen of Troy), the most beautiful woman who ever lived — ten years and seven children too late. As for the third wish, well, if you want to live for ever, you have to go back to the start of "ever", right?
Also Played for Laughs when it's noted that "yes, but not this bit!" has not been recognised as a valid clause in magic spells ever since the late Funnit the Forgetful's arguably successful spell to destroy the entire tree he was sitting in.
Be careful what you wish for. You never know who's listening- or what.
At the start of Night Watch, a crankier-than-usual Commander Vimes complains about how he never gets to walk a beat anymore and people keep expecting him to employ minorities and take an interest in foreign politics. He's promptly zapped back in time to when the Watch was an all-human gang of layabouts and petty thieves, with the madman Lord Winder as Patrician, and Ankh-Morpork on the verge of bloody revolution. The nostalgia filter wears off fairly quickly.
Susan Sto Helit (the granddaughter of Death) has an I Just Want to Be Normal attitude... right up until the events of Hogfather, where she finds out too late she is normal in the Tooth Fairy's realm, as it is based on the imagination of children and neither Death nor his powers exist there. This directly leads to the minions of the book's Big Bad getting the drop on her.
This is a major theme of the Disney Chills series, as the heroes' wishes for popularity, beauty, and social cred always come with a price.
Silk offers Adam a single wish for stopping the Composer. He decides to sit on it instead of immediately cashing it in, and Laura notes that any wish she grants is liable to have some kind of trick hidden within.
In the finale, Silk offers a boon to Laura in exchange for Derek's body. Laura claims that Adam didn't get a good boon, but Silk insists that he got exactly what he wanted and is satisfied. Derek accepts the deal, but Laura decides to wait before cashing it in.
In Dora Wilk Series, three girls in Toadies jokingly wished for their exes to become animals that represent them best. To their horror, not only does this work, but it turns out that turning muggles into animals is considered a serious crime — fifteen years of community work is considered getting away lightly.
In The Emperor's Winding Sheet by Jill Paton Walsh, the last Emperor of Constantinople said that in his youth he plotted and schemed to become Emperor, and God punished him-by making him Emperor.
Enchantress from the Stars: Young, overenthusiastic Elana wants to be a part of expedition on Andrecia. She gets her wish when Ilura, another agent, is killed and from then on is on for a very harsh mission from which she now can't back down.
One of the characters in The Eschaton Series: Singularity Sky by Charles Stross receives three wishes. His first wish is to be young again; he becomes eight years old. Not quite what he had in mind, but as certain people sought to kill him, he was not going to complain. His second wish is for some "real friends"; he gets some talking animals. His third wish is for adventure. Bad idea.
Fairy Haven and the Quest for the Wand by Gail Carson Levine. The Neverland fairies get a wand to repay a mermaid, but, unaware that all wands have a mind of their own, accidentally pick one of the meanest wands.
Discussed by Hazel and Augustus in The Fault in Our Stars; Hazel had used her wish to go to Disney World and Epcot, but Augustus saved his wish in case he could think of something more meaningful. He eventually uses it on a trip to Amsterdam with Hazel to meet Peter van Houten.
Forms most of the plot of the Edwardian children's novel Five Children and It by E. Nesbit — the "it" of the title is a cantankerous sand-fairy, whose granted wishes always backfire on the children.
Matt wishes for something interesting to happen to him in his boring town, and to get away from his dad. One day, he hides from his dad in a childrens ball pit at an abandoned pizza place, which transports back in time him to Freddy Fazbears, where kids are being killed by a stranger in a yellow bunny suit. He tries to go back, but when he does, the killer comes with him and tries to trap him and his dad in the pit.
Sarah wishes to be as beautiful as the models in her magazines or the popular girls at her school. She meets Eleanor the robot, who says she can grant her wish. Every time Sarah wakes up, a part of her body has been changed to match the models or popular girls, who take notice on her. Turns out, Eleanor has been surgically removing Sarahs body parts as she slept and replacing them with robot parts modeled to look like human parts on the outside. When she loses the necklace that Eleanor gave her, Sarahs body falls apart and she becomes nothing more than a rusty pile of junk while Eleanor dons her old appearance and takes her place in the outside world.
Millie is obsessed with death and actually looks forward to her own end. Not only that, she is rude and distant to everyone trying to reach out to her. After a party, she climbs into a Freddy Fazbear animatronic suit, which comes to life and traps her inside, tormenting her with lengthy, gruesome descriptions of how he will slowly and painfully kill her.
In Freaky Friday, Annabel wishes she could be her own boss. She soon is (via being body-swapped with her mother), but finds that there are a lot of things to be considered.
Another work by Brunner, Galactic Consumer Reports 2: Automatic twin-tube wishing machine, states that the machines are "twintube" because the inventor of the machine got killed by a creature it created, so they had to develop a second tube that would moderate the wishes. The story contains many examples of the second tube not quite working as needed, but it's still better than the sometimes sold cheaper one tube machines... apparently, one world is quarantined because a five year old child who wasn't given ice cream got angry, so he used such a machine to create an army of Killer Robots and take over the planet.
In Hans Christian Andersen's "The Galoshes of Fortune", the titular shoes grant the wishes of whoever is wearing them. This usually ends badly, as the characters are unaware of their power. For example, the Councilor of Justice held the view that in the time of King Hans, around 1500, everything was better; when the galoshes transport him to that age, he finds out that it was actually much worse.
Iben's backstory in The Girl from the Miracles District. Iben used to be a mortal man married to an immortal huldra. As he was aging, he realized he couldn't stay with her for much longer, so when Frigg offered him a wish, he asked to become immortal as well so that he might spend eternity with his wife. Unfortunately for him, huldra are only allowed to bind themselves to mortals, so now she can't stay with him for longer than a few days before she has to leave for weeks or even months on end.
In Half Magic, a group of children find a magic coin that grants unlimited wishes. The catch is that it grants only half-wishes (ex: wishing to be invisible makes you appear half-translucent). It also grants not only wishes that are spoken out loud but wishes that are merely thought of. The children quickly learn to be very careful with wording their wishes, but they still get into various mishaps until they make a final Selfless Wish for their mother and leave the coin to be found by a needy family.
Jack: I should be able to just stick out my arms, and have a princess fall right into them!
Non-supernatural example: In Margaret Atwood's The Handmaid's Tale, the character of Serena Joy is a former conservative televangelist who preached that women belonged in the home and helped to support the overthrow of the United States by the theocratic Republic of Gilead; by the time of the novel, she has been stripped of her public role, reduced to the role of subjugated housewife, and forced to be present while another woman — the Handmaid of the title - has sex with her husband every month. As the latter character wryly notes, "How furious she must be, now that she's been taken at her word."
In Harry Potter and the Chamber of Secrets, for a good portion of the book, Harry wishes that the other Hogwarts students would stop believing the rumors that he's the Heir of Slytherin. Eventually they do, but only after Hermione gets petrified, causing everyone to realize Harry would never attack one of his best friends if he was the actual culprit.
Cho's finally interested in Harry! Only she won't stop crying about Cedric, she's a Clingy Jealous Girl about Hermione, and her best friend betrays the DA to Umbridge. To make matters worse, as Hermione puts it, Cho's main interest in Harry lies in how he was the last person to see Cedric, her previous boyfriend, alive.
Ron is excited to take the Knight Bus back to Hogwarts after Christmas, claiming that he's always wanted to ride it. After he gets thrown to the floor for the sixth time:
Ron: I've changed my mind. I never want to ride on this thing again.
Throughout much of Harry's fifth year, he wishes that people would believe his claim that Voldemort has returned. At the end of the year, people finally believe him, but since the circumstances that led to people believing him also involve Sirius' death, at this point it doesn't seem so important to him anymore.
Near the start of Harry Potter and the Half-Blood Prince, Harry learns that Snape has at last achieved the post of Defence Against the Dark Arts professor, and is overjoyed that this means that Snape will be gone by the end of the year due to the curse on the position; he is "keeping [his] fingers crossed for another death". He gets his wish, but it turns out Snape just gets promoted to headmaster after Dumbledore is killed.
The oldest brother asks for an unbeatable wand to ensure his victory in duel, and Death gives him the Elder Wand. He wins a duel with it, but when he boasts of the wand in a pub too much later that night, he ends up killed in his sleep by a thief coveting his wand.
The second brother asks for a gift that would reverse death, and Death gives him the Resurrection Stone. He uses it to bring back his fiancee, who died shortly before their marriage was to take place, but it turns out that the dead cannot truly be brought back to life and he's Driven to Suicide upon realizing that he can't truly be with her in this state.
The Hearts We Sold takes place in a world where demons can make deals with humans in exchange for their body parts, so this naturally comes up.
A girl the protagonist meets at a party wished for her fighting parents to love each other again, but the demons can't change human emotions. So instead she wished for her parents to stay married. They did, but now they hate each other more than ever.
James wished for the talent to make it as an artist instead of wishing to cure his fatal brain tumor, so that he could leave an impression on the world long after he'd died. Once he begins falling in love with Dee, he tries to change his wish to cure the tumor instead, but the demon can't undo his original deal.
Some form of the phrase is known to just about every culture in the Heralds of Valdemar novels. It gets directly invoked in Bastion, when the headman of a border village decides that they can get along just fine without fancy-pants Heralds showing up with the new laws from Haven — by the time Mags and Jakyr finish pointing out everything they've just "won" along with their freedom (short form: no more Healers, no more Guard, and did we mention this area is known for bandit attacks?) the entire village throws their headman out of office.
In The Hitchhiker's Guide to the Galaxy, Earthman Arthur Dent has a throwaway line in which he wishes he could have a daughter so he could tell her not to marry a Vogon (a particularly unpleasant alien race whose representatives blow up the Earth). Later on in the series, he finds he has to make donations to sperm banks in order to make money to survive on his travels... only for Trillian, the one other (female) survivor of Earth deciding she wants a kid, producing the troubled and somewhat rebellious Random, who ultimately gets unceremoniously dumped on her unsuspecting father due to her mother's hectic new lifestyle as an intergalactic reporter. Whilst the books and radio series pass over this fact unceremoniously, the stage adaptation makes mention of it: needless to say, Random needs no convincing and rudely dismisses the very possibility.
For most of his career, Horatio Hornblower really wants financial security (he's terribly unlucky with prize money, which is the real source of a captain's living), recognition of his good work by the Service, and (after The Happy Return) a way to marry Lady Barbara and a title to impress her. He gets all of it at the end of Flying Colours — but because his hero's welcome and title are calculated propaganda, he and Barbara are freed by the deaths of their spouses, and his constant self-loathing makes him feel like he deserves none of it anyway, Hornblower starts hating it before the last page.
Household Gods: Nicole wistfully wishes for a better life in ancient Rome, and to her horror the gods she entreated are quite real, granting her wish.
House of Leaves: Its implied that the Houses terrifying behavior may be a clumsy, twisted attempt at wish fulfillment. Holloway wanted the ultimate adventure and to be remembered, so hes sent on a horrifying journey through the Houses interior that drives him insane and helps him be remembered as a murderer by manipulating him into killing Jed. Tom wanted to be as respected as his Pulitzer Prize winning brother; after the House kills him, his family and friends gain newfound respect for him, with Will saying he was a true hero. The Navidsons wanted to come together as a family, and they do... by being relentlessly terrorized by the House until they finally learned to depend on each other.
The In Death series: Eve is doing paperwork, which she hates, at the beginning of New York to Dallas. She wishes that there was some murderer out there for her to go get. She gets it in the form of Isaac McQueen, a rapist and pedophile, who was the first murderer she took down while she was in uniform, and is out for Revenge against Eve. It goes From Bad to Worse when Isaac goes to Dallas, the place where she killed her father in self-defense at 8-years-old. Paperwork suddenly looks very good right about now.
Along the same lines as The Handmaid's Tale, Sinclair Lewis's It Can't Happen Here details the takeover of the U.S. government by a fascistic regime led by a demagogue named Buzz Windrip. Some characters who initially support Windrip's regime wind up becoming imprisoned or executed by it.
Truth in Television: among the many, many victims of the Nazis were some of the senior members of the Nationalist and Center Parties, which had originally supported Hitler (under the impression that it was him or the Communists, and the Communists were worse.) Windrip isn't quite a Hitler Expy, but Lewis was writing in the 1930s and almost certainly expected his readers to spot the parallels.
Common in Jonathan Strange & Mr Norrell, especially when fairies are involved. The Gentleman with the Thistledown Hair even invokes this, as one of his plans for defeating Jonathan Strange is to appear to him and offer him whatever he wants, on the basis that it's bound to cause him trouble. That plan rather backfired when Strange doesn't ask for infinite gold, the most beautiful woman in the world or something distracting and troublesome like that, but instead asks for various lost pieces of information about magic The Gentleman doesn't want him to know, leaving him flustered and trying to convince him to pick something else.
In A Land Fit for Heroes, the demon-gods of the Dark Court listen to the prayers of their followers, and occasionally grant them. It is thus not uncommon for people to end up regretting that they got what they wished for.
Takavach: Here's a young man — quite a number of young men in fact — all dreaming of battling monsters out of Skaranak legend, praying fervently for some opportunity to test their heroic mettle. Wolves, steppe ghouls, flapping wraiths, it really doesn't matter which, their prayers are vague — as long as it's a monster, bring it on. Well, we choose one of these idiots and we answer his prayers.
In Ursula K. Le Guin's The Lathe of Heaven, the protagonist is repeatedly asked to dream of a solution to a pressing problem, and the solution turns out to be worse than the original. For example, asked to make sure that there is enough food for everyone, he dreams of a plague that has killed most people in the past, and the survivors have enough to eat. Then, he's asked to find a way to avert a threatened global war, so dreams that the nations of the Earth united... against the threat of an alien species that has taken up residence on the Moon. Then, when he is asked to dream that the aliens are no longer on the moon, so he makes them leave the Moon for... Earth.
At the start of The Legendsong Saga Glynn wishes for Ember to forget that she is dying. Then when Ember passes through the portal the transition removes all personal memories including this very important warning...
In The Voyage of the Dawn Treader, one of the seven lords is stranded on an island where all of your dreams come true. When the Dawn Treader arrives there in search of him, they initially think that this sounds pretty good, until poor Lord Rhoop corrects their misconception: not daydreams, dreams. Including nightmares. Once the sailors take a moment to think about some of the dreams they've had, they quickly throw their full efforts into getting the hell out of there.
In The Magician's Nephew, the fruit that Digory picks for Aslan grants wishes. But as the writing on the garden wall warns...
Come in through the gold gates or not at all.
Take of my fruit for others or forbear.
For those who steal or those who climb the wall
Shall find their heart's desire and find despair.
Comes up multiple times in The Locksmith, starting with a wish for adventure getting the protagonist in to hazardous situations, and later a wish that a wizard who knows and appreciates what I am would show me he loves me. Id even cut off my hair for that that does, among other things, cost Lucinda her hair.
Also part of the backstory of the Nazgûl: they were once mighty, arrogant Kings of Men who desired power and long life. So Sauron gave them magic rings. Now they are immortal...undead slaves to Sauron's will.
The other Rings of Power save the One Ring acted in a similar fashion. The Dwarven Rings helped the dwarves discover vast riches, feeding and exacerbating their Gold Fever to their detriment. The Elven Rings helped the Elves preserve their way of live, furthering isolating them from the rest of the world. These rings may not have allowed Sauron to control the Dwarves or the Elves to the same extent as Men, but their influence weakened their ability to challenge him.
Elder God K'rul from the Malazan Book of the Fallen has a penchant of giving too freely, even powerful things that should not be trifled with. The first thing the Tiste do with his newly-created magic system in the prequel The Kharkanas Trilogy is to exploit it to see how many people they can kill with it. K'rul just wanted equal opportunity magic for all.
In Edward Everett Hale's short story "The Man Without a Country", Philip Nolan, as a young man enamored with Aaron Burr, cries out at his court-martial, "Damn the United States! I wish I may never hear of the United States again!" The court grants him his wish by sentencing him to forever live on ships sailing away from the United States and be forbidden from ever hearing or reading anything about the United States ever again. He comes to really and truly regret his wish, and makes sure to tell the narrator not to make the same mistake he did.
The Mirage showcases a world where the United Arab States of the Middle East and North Africa is the world's sole superpower and Islam is the dominant world religion while the Christian States of America and Europe are considered crapsack third-world hellholes ruled by fundamentalist theocracies. It turns out that an American soldier found a Djinn and instantly wished the entire Iraq War had never happened. The Djinn interpreted the wish to remake the entire world. The serviceman openly lampshades how he should have been much more specific in what he wanted.
In Momo, Momo's friend Girolamo dreams of being rich and famous. Later in the book, to distract him from helping Momo, the villains arrange for him to become famous for his storytelling; he gets all the physical comforts he dreamed of, but so busy he has no chance to enjoy them properly and feels increasingly pressured to cut corners on his art, and a growing sense that he's lost the best parts of himself. When Momo finds him again, he tells her that having his dream come true was the worst thing that ever happened to him.
W. W. Jacobs's classic short story "The Monkey's Paw" concerns a married couple who receive the title item as a gift from a friend who served in the British Army in India. The paw grants its owner Three Wishes, and the husband uses the first of these to wish for 200 pounds; the couple subsequently learns that their grown son was killed after falling into the machinery at the factory where he worked, and they are offered £200 as compensation from the employers. The wife then begs the husband to wish for the son to be brought back to life; after he does so (with great reluctance), they hear a steady knocking on their door. As the overjoyed wife runs to unlock and open the door, the husband realizes to his horror that the son will have come back in his mutilated state, and quickly uses the third wish; when the wife finally gets the door open, there's nobody there, implying that the third wish was for the son to be returned to the grave.
In Peter Freund's Mysteria series, there is a teenage girl Jessie who, when her father starts a book about the titular land, is excited of it and wants to go there; and then she accidentally gets stuck in Mysteria, which is very bad because she requires insulin injections and Mysteria doesn't offer this, even with the magic, so she must find a way back before her supply runs out.
Bastian has it invoked on him when he discovers he's a book character.
"You wish for something, you've wanted it for years, and you're sure you want it, as long as you know you can't have it. But if all at once it looks as though your wish might come true, you suddenly find yourself wishing you had never wished for any such thing."
The Acharis suffer from this as well. They ask Bastian for new bodies but come to regret it much too late as they no longer enjoy being carefree clownish beings and can no longer fulfill their original purpose.
The Edgar Allan Poe story "Never Bet the Devil Your Head" is an odd case of this. A man tells a story of a friend who says he'd "bet the devil his head" that he could perform a particular trick; out of nowhere, a mystery man shows up eager to take him up on his bet, and sure enough, he manages to decapitate himself and the man runs off with his prize.
Nightfall (Series): Myra wishes to leave the Resistance hideout and see the outside world. When it finally happens, she is captured by the enemy.
The Night Garden: The titular place has the power to grant the wish of whoever is inside of it at night. The catch, however, is that a wish cannot be undone, even by another wish. And the person only gets one.
In The Obsidian Trilogy and The Enduring Flame Trilogy Wildmages can make wishes to the Wildmagic which will grant it for a price which varies depending on the difficulty of the wish. Since the magic will grant you what you ask for, not what you want, Wildmages are warned to think carefully what they really want/desire in order to not waste time and energy paying off a wasted wish, and to minimize the cost of any necessary wishes.
Orkneyinga Saga: When drinking in Jarl Paul's hall, Paul's retainer Svein Breast-Rope feels so insulted by a minor taunt of Svein Asleifarson, he mutters to himself "Svein will kill Svein, and Svein shall kill Svein". Eyvind, another retainer, hears it and warns Svein Asleifarson. Svein Asleifarson decides to not wait for the other Svein's initiative, and thus Svein Breast-Rope's words come true—though naturally not the way he intended them.
In Paradox Bound, Zeke is confronted by Fifteen for allowing Eli to get out of town, despite being specifically told to keep an eye on him. Trying to defend himself, Zeke says that he would've done a better job if he'd had more information. Fifteen thinks about that for a moment, then decides he's right. Then he knocks Zeke out and takes him back to his HQ, so that Zeke can be turned into one of the Faceless Men. Since all Faceless Men are always certain of everything around them within the range of 200-300 feet, Zeke (well, Zero now) gets his wish.
In The Picture of Dorian Gray, the titular character makes a Deal with the Devil to stay young and good looking forever; instead, a life sized portrait of him will age in his place. While he enjoys his life of consequence-free debauchery at first, eventually the picture begins to serve as his conscience, reminding him of things he'd prefer to forget. Comes complete with a heavy dose of symbolism, as after he commits murder blood appears on his portrait's hands. Eventually, trying to eliminate the portrait and the evidence of his sins causes his own death.
A Prayer for Owen Meany: Rev. Merill was at the fateful baseball game in the book when he saw Tabitha wave hi to him. Feeling shameful about the affair he had with her, he wished that she would drop dead. A stray baseball from Owen's bat later...
At the end of L. Jagi Lamplighter's Prospero in Hell, Miranda reflects on how she had wished to have a common enemy for her family to unite against. She got one. (It's the second in a trilogy.)
The Red Dwarf novel Last Human features this as part of the climax; the characters are faced with an attack from the Rage, a gestalt entity composed of the intelligences of billions of unjustly executed people. They've hit upon a ritual wherein they form a circle that enables the Rage to possess one member, killing them in the process. One of the characters consumes the Luck Virus, a "positive virus" which grants the person infected by it with the ability to instantly acquire anything they want, in order to ensure that they aren't the one chosen to be consumed by the Rage. Unfortunately, it turns out that during the ritual, the combination of being driven insane by the anger and fury within the Rage coupled with how seductive its sheer power is results in everyone taking part begging to be consumed by it — and only one of them has taken a virus which gives you everything you wish for...
In Red Mars, one of the First Hundred colonists on Mars is Arkady Bogdanov, a visionary who dreams of remaking humanity on a new world and craves revolution to escape from the old-fashioned and oppressive political structures on Earth. When the revolution comes in 2061 he's as happy as a clam in his free city. Until, that is, it's sabotaged and immolated by U.N. forces, killing him and hundreds of others. The Revolution of 2061 turns into a total bloodbath as the U.N., now a puppet of "metanational" corporations, hunts down and slaughters as many revolutionaries as it can, locks down control of Mars, and forces the survivors deep into hiding for decades.
In the medieval Chivalric Romance of Robert the Devil and all its variants, the parents wish for a child — whether from God or the Devil. The son is therefore born possessed by evil. (Fortunately for him, in due time, he repents and does penitence for his evil. This results in either marryingthe princess or becoming a saint.)
In C. J. Cherryh's Russian trilogy (Rusalka, Chernevog, and Yvgenie), wizards work magic by wanting something. Since the form of the wish takes the easiest path, a wish, for example, for the five-year-old wizard's father to not hit him again could and did result in the house burning down and both his parents dying in the fire. Every wish is fraught with the potential for disaster, and not wanting things is like not thinking of elephants, so wizards, by and large, end up insane hermits.
The Saga of the Greenlanders: When Thorvald Eriksson and his companions discover and explore a wooded headland in Vinland, Thorvald likes the spot and says that he would like to make his home there. A little later they are attacked by natives, and Thorvald gets a deadly wound from an arrow. Before he dies, he advises his companions to bury him on the headland, and remarks that his wish did indeed come true: he will stay on the headland.
Serwe's backstory in Second Apocalypse has a lot to do with this trope. Her prayers to gods come true several times but not in a way she wants.
Septimus Heap: Lampshaded with Marcia becoming ExtraOrdinary Wizard, since she wished it all the time and it eventually became true... by Alther being shot on the day she became EOW: "Beware what you wish for, lest it come true"
Another nonmagical example appears in the Frederik Pohl story "Shaffery Among the Immortals", in which the eponymous protagonist is a fourth-rate "scientist" who desperately wishes to become famous. In the end, one of his useless puttering experiments accidentally creates a mutated form of botulism, AKA "Shaffery's Syndrome" which goes on to kill roughly 95% of the human population, with Shaffery himself being one of the first victims.
In a 1941 Theodore Sturgeon short story "Shottle Bop", a seer-of-ghosts sees a ghostly couple in an endless feedback loop, repeating a conversation, summed up as follows: "If we kill ourselves, we're sure to be together.... forever.... just like this." "Will we, Tommy?" "I promise.... just like this."
The Silmarillion: Ar-Pharazôn wants immortality. He succeeds... by effectively becoming undead and a prisoner in the Cave of the Forgotten.
Visaerys Targaryen wants the crown of the Seven Kingdoms back and even marries his would-have-been sister-wife off to Khal Drogo to get backing to take it. Soon afterwards, he screws himself over by pissing off his brother-in-law when drunkenly demanding it happen ASAP, or he'll "take back" the deal by killing Dany and her unborn child. This does get him successfully crowned. With molten gold.
It doesn't quite come true, but there is a scene where Arya (disguised as a servant-girl) is talking to an annoying Frey squire who keeps jabbering about how he's going to marry a princess. At some point Arya just snaps at him, yelling "I wish your princess was dead!" not knowing she just wished her own demise. Averted in some ways in that she's still alive, although whether she's still Arya Stark is questionable.
At the beginning of "A Game of Thrones" Catelyn prays to the Seven Gods that they let Bran stay in Winterfell. He ends up falling from a tower and not being able to walk ever again.
And at one point, Jeyne Poole remarks about how when she was little, she often dreamed how it would be like to be a Stark. Now she does know for sure — and this involves massive Break the Cutie.
In the backstory of Fire & Blood, many Westerosi nobles were dissatisfied with Aenys I, thinking him inadequate compared to Aegon the Conqueror because he wasn't a fighter. Then Aenys died, and his half-brother Maegor (the Cruel) took over.
In Speak, Heather, the New Transfer Student to Merryweather High School, wishes to become a member of The Marthas, the most popular clique in school. She works hard to prove that she can commit to their volunteer projects, and even goes as far as to callously leave behind her less popular friend, Melinda, in the hopes that it will make her look better. She eventually becomes a Martha like she wanted, but their expectations turn out to be too much for her. The Senior Marthas boss her around constantly and treat her like a servant. She's forced to spend so much time on their volunteer projects that she can't keep up with her schoolwork and her grades are going down. When she's given a huge project that she's expected to complete by herself (decorating a hotel ballroom for the senior prom), she comes crawling to Melinda, asking for her help. Melinda refuses because she's already seen exactly what kind of person Heather is and wants nothing more to do with her. As a result, Heather does a terrible job at the decorations, leading to her becoming the new outcast of MHS. Melinda snarks that she should run away and join the Marines because they'll be kinder to her than a swarm of angry Marthas.
In Summer in Orcus, Summer is told a story about a woman who wished to be a dragon, only to find that her dragon body's instincts were stronger than her human willpower and she was unable to stop herself going on a rampage that destroyed her home city and everyone in it.
Discussed in Super Minion. Pebbles asserts that mutating is a better deal than triggering a power, because mutavus provides what the person needs to get out of a deadly situation, while powers provide what they want to get out of a stressful one.
Pebbles: They can both be cruel bastards but at least mutavus doesn't have a sense of humor.
Survivor Dogs: A Pack Divided: Whisper is grateful to Storm for saving him and his pack from Terror, but he ends up being too attached to her. Irritated, she snaps at him to go away and leave her alone. When Whisper ends up killed near the end of the book, she tells herself regretfully that she got her wish, all right.
In the picture book Sylvester and the Magic Pebble, the donkey Sylvester finds a magic pebble that grants any wish he makes while holding it. Soon after finding it, he sees a huge lion approaching him and his panic at seeing the lion causes him to blurt out, "I wish I was a rock," and not realize until after the lion is gone that he can't wish himself back to a donkey because he can't hold the pebble as a rock. He's consequently stuck as an unmoving, untalking rock for months until his parents coincidentally choose his rock as the spot to have a picnic on and place the magic pebble on him, letting him finally successfully wish that he were a donkey again.
Ernie tires of his love relationship with Sam when it becomes clear that Sam outranks Ernie in terms of professional prestige and will soon outrank Ernie (if he doesn't do so already) in terms of income. Ernie resolves to have an affair with someone who does not do so and ends up meeting Danny, who is at the opposite extreme and even wants to become financially dependent on Ernie.
Cassilda advocates for government to constrain others' lives, but her opponents invoke the same government powers whose expansion she advocates to shut down her pet project.
The basic premise of John Brunner's novel The Traveller in Black is that of a man who grants wishes in ways that are almost never to the wishers' liking; the ultimate goal of which is to replace Chaos with Order. At least, those who are selfish get their comeuppance, but the few who are unselfish (e.g. someone who wishes the Traveller success in his present quest, a little girl who wants to make the fire burn brighter so the family hut will be warm) are rewarded. Moreover, the Traveller often simply accelerates a comeuppance that the character was bound to suffer anyway, as when he splashes Lorega with the transformative water she'd intended to jump into already.
Villains Don't Date Heroes!: The novel starts with Night Terror robbing a bank out of boredom and wishing for something interesting to happen. She soon finds herself on the wrong end of an embarrassingly one-sided battle.
In Franny Billingsley's Well Wished this trope is the main basis of the plot. The antagonist sets up the protagonist to fall for this trap. She tricks the protagonist into a making wish that she knows will exchange her crippled body for the protagonist's healthy one.
Mat from The Wheel of Time books is granted three wishes, but doesn't realise it and goes on a rant since he thinks the Eelfinn are similar to the Aelfinn (who answer questions). The Eelfinn turn out to be a much more vicious and dangerous sort of Fair Folk who require concrete stipulations so they don't turn against the person asking them for boons. One of these clauses being that you get to leave their court alive. Otherwise, they might give you a powerful spear by hanging you from it with a noose. As Mat would've died from if Rand hadn't saved and resuscitated him.
In Who Censored Roger Rabbit?, the plot was caused by a case of this. Roger accidentally wound up with a genie that he was completely unaware of; the genie, resentful of being forced to grant his wishes, settled for twisting whatever wishes he heard. The reason Roger keeps getting screwed out of jobs? He wished to be famous, so the genie made him a second banana who can't escape the shadow of his star-making role. His wish to be married to Jessica? The genie got them together, but it only lasted a year before she divorced him. Eddie is Genre Savvy enough to catch onto this and take steps to avoid it, mainly by destroying the genie before it even gets a chance to screw him over.
In Melissa Marr's Wicked Lovely: Ink Exchange, Leslie wishes for 'no more fear and pain' when she gets her tattoo...she ends up being used as a conduit by some very darkfaeries with a Horror Hunger for negative emotions, unable to feel anything for more than a few seconds and barely lucid.
In E. D. Baker's The Wide-Awake Princess, Sleeping Beauty's parents want to protect their second daughter and assure the Fairy Godmother they would do anything to prevent such a curse on her. The fairy godmother makes her immune to magic. Which means she doesn't get the standard gifts that make her beautiful, talented, charming, etc.
In The Wish, Wilma Sturtz is given a wish and asks to be the most popular student at her middle school, Claverford... only to discover the effects only affect students of Claverford, it has no effect to students who are outside or not attending Claverford, and that it will expire the second she graduates.
Bill Brittain's The Wish Giver is all about this. Three children in a small American town (along with the narrator, a man from the general store who answers to the nickname "Stew Meat") get cards that supposedly grant wishes from a mysterious vendor at the county fair, and the three stories in the book deal with the consequences of the kids' ill-thought-out wishes: A sharp-tongued tomboy named Polly wishes people would start being glad to see her, and much to the amusement of her peers she starts to croak like a bullfrog whenever she starts insulting people; a sentimental girl named Rowena wishes the handsome young traveling salesman she has a crush on would "put down roots in Coven Tree and never leave", and he starts turning into a tree; a farm boy named Adam wishes his family's farm had more than enough water, and it ends up flooded. In the epilogue, the trio have learned their lessons, and beg Stew Meat to undo their wishes with his own wish card.
One of the obvious aspects in The Wishing Maiden, as the titular Maiden has no control over how the wishes are granted; it's all in the phrasing, and the phrasing tends to be taken very literally.
Both subverted and not in the short story "The Wish Ring". A farmer is kind to an old woman, and gets a wish ring in return. He shows it to a jeweler to see how much it's worth, and the jeweler steals it from him and replaces it with an identical copy. The jeweler then wishes for a million gold pieces, which promptly begin raining from the sky and crush him to death. In the meantime, the farmer goes home still thinking he has the real ring. Every time his wife suggests something they could wish for, he says no, they can work for that and earn it instead. Eventually they become happy and rich because of their hard work, and die with the wish still unasked.
Another Bill Brittain book, All the Money in the World, has a kid asking a leprechaun for just that. He gets his wish...only to learn that he's unable to spend it, give it away, or otherwise make use of it, because when he tries to do so it boomerangs right back to him. (Also that he's inadvertently bankrupted every nation on Earth.)
Witch Week by Diana Wynne Jones has Charles use his new-found powers to torment Simon, the classroom bully. How does he do this? With a literal game of Simon says; anything Simon says comes true. After a few mishaps (with Simon saying everything from 'You girls stink' to 'I'm not clever at all!'), Chrestomanci comes in, gets Simon to shut up and tells Charles how horribly everything could've gone if Simon had said something like 'Two plus two equals three' or the like.
Eva Nine, the protagonist of WondLa, has a longing desire to explore the outside world at the start of the first book, since she is stuck in an underground Sanctuary with her mother figure aptly named MUTHR. In the fourth chapter of the first book, the Sanctuary is attacked by a hostile assailant, forcing Eva to enter her greatest dream and her worst nightmare mashed into one: having to go above ground to safety by herself .
Stephen Goldin's short story "The World Where Wishes Worked" is about a world where wishes came true automatically. In this setting, people lived idyllic lives as their every needs were met. Unfortunately, there was a fool, whose wishes were so poorly conceived that they always backfired on him. After making a number of increasingly short-sighted wishes, he finally thought of one that would put an end to this chain of misfortune: he wished "that wishes would no longer automatically come true." The next and final line of the story reads, "Things are tough all over."
In the picture book You Don't Want a Unicorn!, the boy makes a wish on a Wishing Well for a unicorn despite the narrator's warnings for him not to do it. The unicorn ends up making a mess everywhere and summoning more unicorns that completely trash the boy's house and the boy has to wish all of them away. The book's sequel You Don't Want a Dragon! has the same boy, not having learned his lesson from the previous book, wishing for a dragon and experiencing the predictable consequences of having a fire-breathing, constantly growing beast for a pet.