Sofia is about to set out for the Kingdom of Tangu to practice her magic carpet dance with Zandar for the Museum Opening Party when a messenger mistakenly delivers a package for the Royal Family of Tangu. Sofia promises to take it to the Royal Palace of Tangu. On the way, the package starts to bounce around. Giving in to temptation, Sofia opens it and finds a lamp inside. Upon rubbing it, she accidentally releases a genie named Kazeem. Sofia asks him to get back in his lamp but the little genie refuses because he wants to have fun since he never been out of his lamp before. Kazeem takes off with Sofia in pursuit.
In the marketplace, Kazeem grants everyone's wishes but ends up making a big mess when he grants a wish that turns a boy's toy elephants into real elephants. Sofia meets Madam Ubetcha again who tells her to go to the Genie Patrol and tells her where to find them. Sofia heads toward a big gold lamp and meets the Genie Patrol's only member Sergeant Fizz, who tells her about the Genie rules and the patrol's job of enforcing these rules and makes Sofia his partner. Together, the pair set out to find Kazeem and stop him.
Meanwhile, Sofia's parents arrive at Tangu Palace to watch Sofia's rehearsal and provide a safety net (Roland's idea) and learn that Sofia hasn't shown up yet. Realizing something's wrong, Roland, Miranda, and Zandar take off on magic carpets to look for her, to Roland's discomfort since he's riding the same magic carpet Sofia rode on during her first visit to Tangu and it still has some of its spunk. Meanwhile, Sofia and Fizz intercept Kazeem at a birthday party but the young jinn refuses to listen and flies off. Sofia and Fizz give chase but Kazeem traps Fizz in the former's lamp, leaving Sofia to deal with Kazeem on her own since a jinn spell can only be undone by the Genie who cast it. At first, Sofia feels guilty for letting Kazeem out and feels like she's not up to the task but Fizz reminds her that now's not the time to play the blame game and assures her she can do it. Sofia resolves to stop Kazeem herself and sets off. Upon finding Kazeem, she gives chase all over Tangu.
Meanwhile, Sofia's parents and Zandar bump into the flying camel Kazeem created. The bumpy ride this causes leads them to finding Sofia, who they pursue. The pursuit leads the quartet and Kazeem to Tangu Palace, where Kazeem sets monkeys loose and Sofia reunites with her parents and the magic carpet she rode during her first visit to Tangu. Sofia tells everyone what's going on and, with help from her parents, Sofia shows Kazeem how unhappy he's made everyone. Repentant, Kazeem grants Sofia's first two wishes: To let Fizz out of his lamp and undo his wishes. As a reward, Sofia uses her final wish to make Kazeem a member of the Genie Patrol, to his and Fizz's delight. Everyone celebrates with Sofia and Zandar's magic carpet dance.
- Ariel Winter as Sofia
- Nathaniel Semsen as Prince Zandar
- Nika Futterman as Madam Ubetcha
- Sara Ramirez as Queen Miranda
- Travis Willingham as King Roland II
- Connor Wise as Kazeem
- Keith Ferguson as Sergeant Fizz
- Sean Schemmel as King Habib
- Miles Gerber as Boy
- Griffin Kunitz as Twin Boy 1 & 2
- Lyons Mathias as Kid 1
- Diamond White as Kid 2
- Jamie Mitchell as Date Seller
- Craig Gerber as Servant
- This is the third time Sofia goes to Tangu. The first was "Two to Tangu" and the second was "Minimus is Missing".
- Madam Ubetcha makes her third appearance in this episode, since her appearance in the first season. The other two episodes were "Two to Tangu" and "Finding Clover".
- The Magic Carpet from "Two to Tangu" makes its second apperence in this episode.
- This is the fifth time Sofia becomes a supporting assistant for someone. The first time was when she became Cedric's apprentice in the episode "Cedric's Apprentice", Aunt Tilly's companion in "Great Aunt-Venture", when she acted as James's royal adviser in "King for a Day", and became Baileywick's junior steward in "Baileywhoops".
- This is the tenth time Sofia doesn't wear her usual outfit throughout the whole episode and the fourth time Sofia doesn't wear her tiara at all.
- This is the first time Roland wears short pants in the series.
- This is Sean Schemmel's second role and character in the series, the first being Slim in "Cool Hand Fluke".
- It is revealed that magic carpet rides scare Roland.
- During the chase, a Wilhelm scream can be heard.
- It's revealed in this episode that the effects of Genie magic can only be undone by the Genie the magic belongs to.
- Prince Zandar's parents are seen for the first time in this episode.
- According to this episode, there are two hundred and four rules that genies must follow.
- Moral: Rules are important.