Games are generally supposed to be challenging. But there are many different ways to achieve difficulty, and some lead to more frustration than fun. Here I'm going to talk about some bad ways to achieve difficulty.
Increasing the punishment for making a mistake. For example, a bad designer might pit you against enemies that kill you in one hit, while you need several hits to kill them. But this is a very frustrating form of difficulty. A better idea would be to make the enemies do less damage on a single hit, but make their attacks harder to dodge, so that the player gets hit more often. It's still equally hard, but it feels better because you're not being instantly killed by a single mistake. No one likes not being given a second chance.
Inversely, making enemies hard by giving them too much health is a bad idea. Repetition is boring. We can all agree on that. And giving enemies enormous health bars leads to repetition in two ways: not only does it force the player to tangle with the same move pattern for longer, but also it means more lost progress if the player loses. Instead, make the enemy more dangerous while you're fighting them, but don't force the player to do it for as long.
Making the controls hard to use. For example, requiring the player to rotate a thumbstick more than 90° but less than 180°. It's fun when you lose a fight because you weren't skilled enough, but it's not fun when you lose a fight because your finger movements weren't exact enough. One of the main advantages of video games over sports is that they make your real life body not matter. We need to capitalize on that advantage.
Not telling the player the rules, or expecting them to know something they have no reasonable way of figuring out. Any time an enemy kills you with an attack you didn't know they could do and couldn't have reacted to properly without being already familiar with it, it's an example of this, as are cases where having a reasonable chance against an enemy depends on setting up some super secret precondition beforehand (Mytha the Baneful Queen, from Dark Souls 2) or you fight two bosses at once and focus your attacks on one of them only to find that if they don't die at the same time the remaining one heals the dead one to full health (Throne Watcher & Throne Defender, also Dark Souls 2). Also, what the absolute fuck is wrong with designers who think it's okay to just not tell players the specifics of how the system works? It's common in RPGs to have spells with descriptions like "increases an ally's attack power", but if it doesn't say how much, then how the fuck are we expected to know whether it's worth learning this spell or not?
Punishing the player for dying. As if having to restart the level wasn't enough of a punishment, some designers feel the need to do things like not return consumable items used on the last try, shrink the player's health bar each time they die (Dark Souls 2), de-level the player's character, or similar. All these mechanics are completely unfair and just bullshit. The game should not get harder when you lose, for god's sake! It does not take a genius to figure this out!