An instructive example:
In The Simpsons episode “He Loves to Fly and He Do'hs”, probably best known for featuring a guest voice by Stephen Colbert, Homer needs to deliver some bad news to Marge, so he decides to do it aboard a private plane.
When he hires the private plane, the exchange goes something like this:
Pilot: Well, anything for a fellow marine.
Homer (nervously): Semper... uh, fudge!
Pilot: Did you just say “Semper fudge”?
Homer: No, I said the right thing.
This is a mildly amusing exchange, but not that important in the long run, other than it reinforces Homer's bumbling doofus persona that features so heavily into most Simpsons episodes, but later on, aboard the plane, Homer finds the pilot passed out, only waking up long enough to inform Homer that he didn't think he'd be flying today, so he did a bunch of heroin.
Another mildly amusing exchange, except that suddenly and without warning, the dynamic has flipped from Homer being the incompetent one to the pilot being the incompetent one. You have an idea of who this pilot is based on is two lines of dialog, and then a later joke that involves him runs entirely counter to who you think this character is. Because they flipped the clearly established character relationship without ever addressing it, something kind of rings false.
You know that high play you were in where you were an extra, and your drama teacher always told you that it was important that you knew exactly who your character was, and where they were going after they left the stage?
Yeah, turns out this is what happens when you don't do that.