This was deliberate on Douglas Adams' part [0]. It's all part of the joke. Other notable sections are where the game actively lies to you about being able to access a particular room (you need to try to enter several times in a row), and then sulks when you call it out and lies about the contents of the room.
Yep - a lot of text adventures were brutally hard, often to make up length, but the Hitchhiker's Guide game was something else altogether. It was tricky, but also gratuitously unfair for the sake of comedy. A lot of it doubled as parody of earlier text adventures, like recreating "guess the command" difficulties by forcing the player to "take buffered analgesic" instead of "take aspirin".
The most famous example, I think, is the babel fish machine: it wasn't actually hard, in the sense that each failure told you exactly what you needed to do fix. But it was unfair, because you got one fewer attempt than the number of steps required. The designers basically expected you would roll your eyes, laugh, and try again with that extra knowledge.
(Which is a pretty standard part of punishingly hard games even today, interestingly. Dark Souls is mechanically hard, but it's also full of easily-managed surprises that are mostly present to create a feeling that the implicit rules of fair design aren't in effect.)
[0] https://en.wikipedia.org/wiki/The_Hitchhiker%27s_Guide_to_th...