This is a stock comedy trope sitcom plotline where a married couple, typically one married for a significant period of time, finds out that due to some kind of technicality or error, they were never legally married.
This leads to dialogue about this revelation meaning that they have been "living in sin" the whole time, as well as a plot in which one or both partners debate staying together, after discovering they aren't legally bound (if this is an ongoing sitcom, they will inevitably stay together). Any kids they have will inevitably fret about being illegitimate.
Things are generally resolved either by the couple re-solemnizing their vows or else discovering that due to another technicality, the original technicality didn't actually prevent them from being legally married.
This is kind of a Dead Horse Trope for a number of reasons. For one thing, cohabitation between unmarried couples and sex outside of marriage are no longer as stigmatized (if at all), so the coy talk about living in sin is no longer a huge concern. The trope also implicitly lends itself to an earlier time in which divorce was stigmatized/required cause (whether or not legally accurate, the idea is that one or both parties could get an annulment at this point even if the law did not let them divorce). One other factor is that record keeping has improved, and so technicalities involving paperwork are less likely to happen.
- In the Mobile Suit Gundam Wing sequel Frozen Teardrops, Heero and Relena are living Happily Ever After in a nice house on a terraformed Mars. Although they have had a wedding, and own a house together and are contemplating having a baby, their marriage is not considered legally valid because when they went to get the marriage license, they were denied because Heero couldn't produce documentation that would prove who his father was, as his parents were not married. Heero finally found the documentation he needed, and suggests to Relena that they get legally married, so their kids won't have to go through all the hassle and stigma that he had to go through.
- Mr. & Mrs. Smith, directed by Alfred Hitchcock, has a couple find this out when in the mood to rethink things. When the husband gets kind of dickish about formalizing the marriage, the wife gets mad and starts demanding a divorce.
- The romantic comedy film We're Not Married has this its premise. A justice-of-the-peace is appointed and starts marrying couples on Christmas, even though his appointment doesn't officially take effect until January 1 of the New Year. Two years later, the error is uncovered, and he contacts the couples he married to let them know they were not officially married due to the mistake. The film deals with five different couples with diverse quirks deciding whether to stay together.
- In Dinosaurs, the Sinclairs discover on their 20th anniversary that they need to renew their marriage license to stay married. Hijinks ensue.
- In the Good Luck Charlie two-parter episode, "Snow Show", it is revealed that Bob and Amy Duncan were not legally married because they were scammed by a con man who impersonated a judge. At the end of the second part, they have a legal ceremony with all four of their children present.
- Happy Days: Played for relief in an episode where Fonzie and Jenny Piccolo go on a Halloween cruise as bride and groom and get "married" by the captain dressed as a priest. Jenny moves in with Fonzie and starts to set up house, but later reveals that they're not really married.
- The I Love Lucy episode "The Marriage License" has Lucy discover a spelling mistake on her marriage license, leading her to believe that this means she's not really legally married to Ricky. Hilarity Ensues.
- An episode of Gilligan's Island had Mr and Mrs Howell discovering they were not really married after hearing a news broadcast that the minister that married them had really been a con man and not actually ordained. Various hijinks ensue till they get the Skipper to perform a ceremony on a raft floating in the lagoon. At the end of the episode, another news broadcast reveals that the original broadcast had got the name of the minister wrong, and they actually had been married all along.
- On one episode of The Dick Van Dyke Show, Rob and Laura discovered they're not actually married because Laura had lied about her age in order to marry (she was 17 apparently). They fix it by quickly getting married ...again.
- Inverted on Scrubs when Perry and Jordan believe themselves to be divorced. It turns out the paperwork had never gone through and both of them had been legally married up to that point. This screws up their relationship so badly that they go ahead and get the divorce finalized for real complete with a formal un-wedding (while still remaining a couple).
- This is used repeatedly as a plot in Shameless (UK), with both Frank and Sheila, and later, Paddy and Mimi.
- What I Like About You had Val and Vic enter an Accidental Marriage Vic didn't want undone, but Val did because of it flying in the face of her Control Freak nature. When Val finally decided she loved Vic and would just roll with the bizarre circumstances they got together under, embracing their marriage, it came out the Elvis impersonator that married them wasn't a licensed minster and their marriage wasn't actually valid. They then Altar the Speed and try to get married for real.
- Played With in Dharma & Greg, when Edward discovers that his divorce to his first wife never went through, meaning that not only is his and Kitty's marriage invalid, he's still married to Wife #1. Upon learning this, however, Kitty actually seems rather intrigued to learn that she's technically "the other woman."
- Happens with Dre and Bow when they're about to renew their vows in Blackish. The kids all become worried that they're all bastard children.
- An arc in Sherman's Lagoon involved Sherman and Megan finding out that the official who married them had been a fake, and they were never technically married.
- J. B. Priestley's comedy play (later filmed) When We Are Married deals with three Yorkshire couples who all married on the same day and discover on their silver (i.e. 25th) wedding anniversaries that they were never married due to a legal technicality. This leads them to re-evaluate their marriages and air their grievances, but they all eventually decide to stay together. Interestingly (and fitting this being a somewhat hoary trope) while Priestley's play was written in 1938, it is set in The Edwardian Era in 1908.
- Please Get Married, a 1919 bedroom farce play written by Lewis Allen Browne and James Cullen, is about a young couple whose honeymoon is ruined when news spreads that the minister who supposedly married them was arrested for burglary.
- In Abie's Irish Rose, the parents try to invoke this when they find out that Abie and Rose married each other under assumed identities. This fails because of their prior elopement in Jersey City, which happens to be totally legitimate.
- A storyline in Kevin & Kell, when they discovered that their marriage was never registered (Rudy was acting out about having a rabbit for a stepfather and "forgot" to post them), just as a law is being voted on that would prevent future predator/prey marriages. Their race to get legally married before the vote ends up stirring the politicians into voting against the law.
- Late in Two Evil Scientists, it's revealed that Wily and Vanilla's marriage wasn't actually valid because Eggman lied about getting ordained online (he failed the ethics portion of the test and didn't tell them because it seemed like the unethical thing to do). Since Wily was currently in jail for trying to take over the world again, Vanilla (who was only willing to stay with him because she didn't believe in divorce) decides to cut her losses and leaves him to rot.
- One episode of The Flintstones has Fred and Wilma told that their pastor wasn't licensed when they went for a second honeymoon, leading Wilma to insist Fred court her again. At the end of the episode, they return to have a proper wedding where the clerk mentions a hilarious prank his colleague pulled the other day where he convinced a couple their marriage was illegitimate....
- Harvey Beaks: In the episode "Mr. Borks and Mrs. Borks", Irving discovers that he and Miriam technically aren't officially married due to a misspelling of their surnames in their marriage certificate. As a result, the two decide to prepare a second wedding to get a proper marriage certificate, and Harvey and his friends are eager to help them out with it.
- An episode of The Jetsons has George and Jane revealed to be not legally married due to the original priest who presided over them being a conman. They decide to actually get married and along the way go through a series of events that strangely enough mimics their pre-marriage romance. With their love rekindled ever more, they finally get married presided by an actual priest, who unfortunately was not let in the whole thing beforehand as he gets shock when he finds out that the bride and groom's fully grown children are the best man and woman.
- Happens on The Simpsons, on the episode "Wedding for Disaster". As a Continuity Nod to the episode "A Milhouse Divided" (where Luanne and Kirk Van Houten divorce and Homer temporarily divorces Marge to give her a "proper" marriage), it is discovered that Reverend Lovejoy was not officially working as a reverend during that specific time (due to a snafu in paying the church a monthly operating fee), and thus the marriage was not official. The moment Rev. Lovejoy mentions this, tensions escalate on the Simpson house until it looks like Marge will abandon Homer, not to mention her becoming a Bridezilla during the new nuptials and Patty and Selma kidnapping Homer and putting him through Saw-like tortures, hoping that Marge will forget about him.
- Has actually been known to happen in real life. In this case, the couple (who had been married 48 years) found they had no marriage license- the person who marries a couple is supposed to return the marriage license to the county records office, where it becomes a marriage certificate, and their pastor never did.