I've gave several examples of traps that worked, I might as well also describe a failure of design by me.
The party was exploring an underground Necropolis of a lost civilization that had been ruled by necromancer kings - some of whom they knew had ruled as lichs. They'd entered into the Necropolis through the tunnel of a grave robber that was trying to recover a particular necromantic artifact of great power, and they were trying to head him off before he found it. The party had deduced that they could track the bad guys basic movements by only going through the open doors, thereby avoiding most of the lethal traps the ancient kings had filled their tombs with. So far so good.
In theory a lot of the stuff in the necropolis was way over the parties current level, which at the time was mostly 5th-6th. For the most part, I'd blocked off access to the higher CR stuff or felt I'd left very obvious clues that said, "Warning: Don't go this Way", and for the most part that was working as intended. One part of the dungeon consisted of a ghoul warren that straddled several of the ancient Kings tombs. In that area I'd placed several CR 2-4 traps that I felt the party could manage and which I hoped - together with past experiences with my traps - would to help promote the atmosphere I wanted, which was, "You are in way over your head!"
In one side area I'd decided to place a trap based on Evard's Black Tentacles. I'd rated this trap as CR 7 based on the general nastiness of that spell, and I had some misgivings about it but simming it in my head I figured the party would be safe - there'd be basically one tentacle per party member and most members of the party had some effective counter strategy (turn ethereal, short range teleport, high escape artist check, brute force, etc.) and everyone had enough hit points to survive at least 4-5 rounds. To be extra safe, I decided to telescope the hazard in the room in the description by describing it as a treasure vault, that there were large number copper coins scattered around the room, the fact that the furnishings of the room had been smashed, and the pointlessness of the room by describing the only other exit as being sealed shut. All of this was meant to signal high likelihood of trap with low likelihood of a worthwhile reward. I figured the party would avoid it - which initially they did - and at worst it would be a tough encounter involving a lot of heroic party cooperation to rescue PC's in harm's way.
Everything however went wrong.
We had an unfortunate long break with no gaming. When we got back, the players were rusty, panicky, and got into a relatively easy encounter where party cohesion broke down, players stopped trying to help or cooperate with each other, and it turned into every man for themselves with PC's employing the "I don't have to run faster than the monster, just faster than you" strategy. My atmosphere was back firing because of the players loss of self-confidence following the break. In very short order, we'd had two PC deaths (only the second time we'd had PC deaths in 2 years of fairly regular play). Then, to make matters worse, the party became separated and then got lost and panicked some more. Unsure what to do, they started blundering about, trying doors and exits they'd formerly eschewed as too dangerous despite the fact that they were now at less than half strength. The result of this is instead of the six players encountering the above party level trap, I ended up with just 3 of them in the room. This meant 2 tentacles per party member, which meant greater difficulty in evading or escaping and almost no expectation of another PC being able to assist.
So long story short, we had 2 more deaths. As an excuse, it was only one of two nights we've had with PC deaths and both nights involved separating the party and some sheer stupidity by some or all party members. But it's a bad excuse, because the trap deaths were unnecessary, and I'd once again written cascading failure into the scenario. For the second time, I'd only narrowly avoided a TPK. Had I enforced the 1 tentacle per party member rule in the details of the trap description, or flexed to that design when I realized my mistake, the trap could have still captured the feel, flavor, and danger I intended without being overpowered if my assumptions about the number of PC's in the party proved erroneous.