For the goat seen in this episode, see Missy.
The Goat

HIMYM episode 3x17 (61)

First aired:
April 28, 2008
Pamela Fryman
Stephen Lloyd
Barney's Blog

Images (8)

Lily brings a goat home from school. Ted celebrates his 30th birthday. Barney and Robin deal with the repercussions from their night together. Barney hires Marshall to help him find a loophole in The Bro Code.


The episode begins with the aftermath of the events of Sandcastles in the Sand. Barney and Robin are in bed together. Robin proposes that they pretend their tryst never happened, and Barney agrees. However, Barney feels quite awkward and uncomfortable around Ted at MacLaren's later in the day. Hoping to find an excuse for his and Robin's actions, Barney seeks out Marshall to help him find a loophole in the Bro Code, a document very important to Barney's life as a bro (including articles placing bros before hoes, banning bros from hooking up with each other's mothers, and banning eye-contact between bros during a Devil's Three-way). Allegedly written by Barnabus Stinson in the 18th century when Benjamin Franklin and George Washington were too busy to write it themselves, the Bro Code proves to be a very tight document that Ted has followed flawlessly and Marshall fails in finding a loophole. Though she seems fine with it at first, Robin finds the secret even harder to keep than Barney and eventually admits to Ted that she and Barney slept together. That night, when Barney picks up Ted in a limo to take him to Ted's 30th birthday party, an outraged Ted yells at Barney, telling him how wrong it was to sleep with his best friend's ex-girlfriend and that Barney has always tried to use Bro code against Ted but didn't even have the decency to stand by it and that he is the bad Bro and that he always thought that he was the limit to Barney's ridiculous antics. Ted ends his rant by telling Barney that he not only does not want to be Bros anymore, but also does not want to be his friend anymore.

Meanwhile, Lily rescues a goat named Missy when a farmer (played by Alan Fudge) brings it to her kindergarten class and horrifies her students by going into great detail about what will happen to Missy when she visits the butcher. Lily plans to give the goat away to animal control, but becomes attached to the goat while waiting for Ted to arrive at his birthday party. Future Ted reveals at the end of the episode, after hinting at the destruction the goat would do, that he had the story wrong: Everything involving the goat actually takes place during his 31st birthday, at which point — Future Ted also reveals — Robin is living in the apartment.


  • Barney gives a fake history lesson about the Founding Fathers commissioning his ancestor, Barnabus Stinson, to write The Bro Code.
  • After asking Robin "Guess who nailed the chick from Metro News 1 last night?", Barney requests (and is granted) a high five.
  • Marshall tells Barney that "Ted has upheld [The Bro Code] time and time again". Ted and Barney have served as each other's wingmen since the night they met in 2001, as depicted in Pilot and How I Met Everyone Else. Ted and Robin meet after Barney asks her "Have you met Ted?".
  • Barney references the Bro Code for the first time in Zip, Zip, Zip, when he promises Robin not tell Ted that she likes him.
  • In Zip, Zip, Zip, before he and Robin get together in Come On, Ted gives Barney his blessing (albeit seemingly sarcastically) to pursue Robin, while here, Ted gets upset with Barney for hooking up with her.
  • The story of the goat is alluded to in Milk, where Future Ted mentions that his 30th birthday was fun "apart the goat in [his] bathroom".
  • Barney mentions mentally "storing" the image of Robin's breasts in "the BPEG folder"; he discusses the concept of "boob images, or BPEGs" with Marshall in Where Were We?.
  • Barney corrects Robin when she calls him Ted's "really good friend".
  • Barney loves shopping from novelty stores; he wants everyone to come with him to a new Sharper Image store in Slap Bet.
  • Robin jokes in First Time In New York that any girl who sleeps with Barney immediately feels the need to shower. After getting out of her bed with Barney in it, Robin says that she plans to take a shower "'til June".

Future References (Contains Spoilers)

  • In Rebound BroRandy hands Barney a Sky Mall catalogue, referencing the numerous gadgets he buys from Sky Mall here. Also, in False Positive​, Barney shows Ted and Robin a picture of a diamond-studded suit in the Platinum Sky Mall catalogue.
  • Ted eventually forgives Barney for sleeping with Robin in Miracles.
  • One of the Bro Code articles Ted has abided by include alerting Barney to a girl-fight. Barney displays his interest in girl-fights again in InterventionHappily Ever After​, and Jenkins​.
  • Despite learning about GNB's unorthodox business practices, Marshall gets a job with the bank in The Best Burger in New York​.
  • Future Ted mentions that Robin would be living with Ted by his 31st birthday. Robin later moves in with Ted in Not a Father's Day​.
  • Ted angrily asks Barney if he wants to nail his mother too, and in Little Minnesota​, Barney reveals that he kissed Ted's mom. When he elaborates (and embellishes) upon the story in Home Wreckers​, he reveals that it happened soon after the events in Brunch​, meaning he has already broken the Bro Code with Ted.
  • The story of the goat is concluded in The Leap​.
  • Barney would call upon Marshall again to interpret provisions of the Bro Code after Barney would catch Ted of holding hands with Robin in The Broken Code.
  • While here, Barney is seen reciting Article 89, which states that the mom of a bro is always off-limits (with the clarification that a stepmom is fair game under certain circumstances), when Ted reads from the Bro Code in The Broken Code, it is Article 104 that states this, without the clarification.
  • Marshall finds a contract in Barney's office detailing the poisoning of the water supply in Lisbon, Portugal, hinting at Barney's job being to sign off on the company's illegal contracts, thereby making himself a scapegoat, as revealed in Unpause.


  • Barney and Robin wake up together
  • Barnabus Stinson, author of The Bro Code
  • Goat in a party hat!
  • Ted is angry at Barney
  • Ted hits Barney
For a listing of all images on the wiki tagged as being from this episode, see Category:The Goat images.

Memorable Quotes

Girl: So he saved you from an avalanche?
Ted: Yes.
Girl: And he carried you six miles to safety on his broken leg?
Ted: Yes.
Girl: And you're a pre-op transsexual nightclub singer who used to be a member of the Russian mob?!
Ted: (Looks angrily at Barney) ...Da.
Article 87: A bro shall at all times say 'yes'

Ted: Dude, two girls are fighting at MacLaren's!
Barney: [At work] What?!?
Ted: Yeah, it was crazy! This one girl was like [Barney arrives] oh, hey.
Article 29: A bro will, in a timely manner, alert his bro to the existence of a girl fight.

Barney: I can't keep buying things! I have six self-cleaning litter boxes and I don't even have a kid.

Barney: Are you saying you don't want to be bros anymore?
Ted: I'm saying I don't want to be friends anymore.

Ted: I'm gonna go through all my old stuff and getting rid of anything I have no use for anymore. Barney, do you want my Xbox?
Barney: Ted, she has a name! And just what are you accusing me of?
Ted: Liking video games?
Ted makes an innocent offer but Barney has a guilty conscience

Barney: So... I just slept with my best friend's ex-girlfriend
Robin: And I just slept with my ex-boyfriend's really good friend.
Barney: Best friend.

Barney: I'm horrified that this happened.
Ted: How did it happen? Ahh? Barney? I want to know. Tell me exactly how it happened.
Barney: You mean, what position?
Ted: (Jumps at Barney)

Barney: You can't tell anyone. Attorney-client privilege.
Marshall: Why are you doing this to me?
Barney: Because I need you, Marshall, as my lawyer to prove I didn't do anything wrong.
Marshall: How can I help you as your lawyer? You didn't break any laws, did you? Robin knows that you slept with her, doesn't she?
Barney: I didn't break any state or federal laws. But I think I broke a much, much higher law. The Bro Code.

Barney: In my experience the way it normally goes is: we lie her for a while, make a little awkward chit-chat.
Robin: Check.
Barney: Then I make up some cabinet meeting/heart surgery/rocket test flight I've got to be at. Slip out of your apartment and never call you again.
Robin: And later at the bar you tell your good friend Robin the story of your latest conquest and she thinks to her self: "Who is this sad, self loathing idiot who climbed into bed with Barney Stinson?"
Barney: Actually, you usually say it out loud.

Barney: So, You're not mad?
Ted: No, I'm not mad. Well, Robin and I broke up a year ago, we both dated lots of people since then, I'm with Stella now. Seriously, I'm fine with this.
Barney: I'm so relieved to hear you say that.
Ted: Yeah, yeah. Oh, I just remembered, my mom is coming in to town next month. Maybe you'd like to nail her too!!

Robin: Okay, here is the deal Barney: the second my feet touch the floor this never happened.
Barney: Okay. Wait (Barney lifts the sheet up). Right click, save as into the bpeg folder and okay. This never happened. It's a good plan.
Robin: Now we go back to exactly the way things were before.
Barney: Okay. Right. So, Robin?
Robin: Yes, Barney?
Barney: Guess who nailed the chick from Metro News One last night?

Ted: (talking about having a goat in the apartment) Where is she gonna sleep and eat... and go to the bathroom?
Goat: (making a sound goats make whatever the word for this may be)
Ted: Ok, where is she gonna sleep and eat?

Notes and Trivia

Goofs and Errors

  • In the limo, when Ted derides Barney for sleeping with Robin, Ranjit yells at Barney in Persian. Ranjit was previously said to be from Bangladesh, but actor Marshall Manesh is from Iran, where Persian is spoken.
  • Lily asks if Barney is "all smooth down there", but in Columns she saw Barney naked when painting his portrait and so would already know the answer to that question.
    • Almost certainly Lily's blocked any images of naked Barney from her memory.
    • It's possible she meant the way Barney has sex; being "smooth"
    • It's also possible she was referring to the state of his pubic hair, which naturally could have changed since the time she painted him.
  • While on the roof with the goat anticipating Ted's arrival at his party, Lily tells Barney that "Stella just arrived." However, Ted (as the narrator) later realizes that the events involving the goat took place a year later, in the episode The Leap, by which point he and Stella had broken up. In fact, Stella moved to California as described in the epilogue of As Fast As She Can​​, the episode immediately preceding The Leap​​. But it could be that only the goat related incidents were from his 31st birthday and not anything else mentioned. Because when Lily is talking to Robin about having sex with Barney, the goat is there, but the whole Robin/Barney sex thing happened around Ted's 30th birthday.
  • It is revealed that in The Bro Code, 'A mother of a Bro is off-limits', but Barney has admitted to kissing, and perhaps sleeping with Ted's mother, yet Barney does not acknowledge he has broken The Bro Code in this aspect, unless this guideline only refers to sex rather than just kissing. It is later revealed in Unpause that Barney never slept with Ted's mom and that she kicked him out of her car after the kiss.
  • In the limo, Barney says "But not me, brah". Retrospectively, it was clearly stated by Barney that they would never say "Brah" anymore in Little Boys. He says to Marshall "One, we agreed we would never say "Brah" anymore. It was a good week, we had a lot of fun but it's over".

Allusions and Outside References


Other Notes

  • It's revealed that Ted's birthday is April 25th, 1978.
  • The Bro Code is an actual book released as a tie-in for the show. Several of the quoted articles in the show are the same as in the book, although under different article numbers.
    • Curiously enough, according to Bro Code, Article 38, a bro should never punch another bro in the groin, "even in a fight to the death". Early in the episode, Marshall claims that Ted never broke the code. But Ted breaks the Bro Code by the end of the episode, when he punches Barney in the groin in the limo. Although Ted did punch Barney in the groin it can be assumed that Ted was able to do it because they were no longer bros and friends anymore. The fact that Barney gave Ted verbal permission to hit him "anywhere but the face" may also factor into Ted's possible exemption from the code.
  • In Barney's flashback to the writing of the Bro Code, the girl on past Barney's left is wearing a dress from the episode "Halloween" from the show Buffy the Vampire Slayer, which Alyson Hannigan also starred in.
  • This episode shares many similarities with Tick Tick Tick. Both episodes begin with Barney and Robin lying in bed together following on from a kiss at the end of the previous episode (Sandcastles in the Sand and Disaster Averted). In both episodes they try to pretend it never happened but Barney is so nervous he almost slips up. Similarly in both episodes it is Barney who gets the rawer end of the deal. In this episode, Ted forgives Robin but refuses to forgive Barney, ending their friendship. In Tick Tick Tick, after agreeing to break up with their perspective partners so that they can be together, Barney breaks up with Nora but Robin stays with Kevin, leaving Barney heartbroken. Also the proceeding episodes' titles are similar: This episode is proceeded by Rebound Bro and Tick Tick Tick is proceeded by The Rebound Girl.
  • When Ranjit yells at Barney at the limo, he says (transliterated Persian) "na mard, na looti, na rafigh; akhe age oon doost dokhtare man bood ke...". Roughly translated, this means: "Inhuman, traitor, non-friend; if she was my ex-girlfriend, I would put my hands around your neck..."


  • Marshall Manesh - Ranjit
  • Ian Abercrombie - Ben Franklin
  • Jeff Austin - George Washington
  • Alan Fudge - Farmer Frank
  • Alexis Krause - Carol
  • Megan McNulty - Cindy
  • Destiny Whitlock - Little Girl


  • The St. Petersburg Comic Review gave this episode 7 stars out of 10. "A mysterious goat makes an appearance. (Sort of)."


External Links

Previous episode
Sandcastles in the Sand
The Goat
(all episodes)
Next episode →
Rebound Bro