the joke's on sb
the joke's on (one)
1. One is experiencing or will experience a negative outcome, particularly one that was intended for someone else. The phrase typically refers to a practical joke or malicious act that has backfired. Greg set up this bucket of water to fall on me, but the joke's on him now—I rigged it up over his bedroom door. He thought he could steal my job by telling the boss terrible things about me, but the joke's on him—he's getting fired for misuse of company time.
2. One seems silly or foolish. Well, the joke's on me because I spent so much time perfecting our itinerary that I forgot to put gas in my car before the trip.
See also: on