A puzzle's outcome of mechanism should not surprise players
The law of least surprise, or the principle of least astonishment, comes from software design and says that a component of a system should behave in a way that most users will expect it to behave. If too many users are surprised by what happens, there's something wrong with the design.
We can apply the same principle to puzzle design in a few regards.
First, the mechanics of a puzzle should behave as a reasonable player would expect them to. This applies to both real escape rooms, as well as software puzzles. Though in the realm of software it can be much easier to break the rule.
For example, we expect a switch beside a door will turn on the lights in the room, not turn on the coffee machine. Or that turning the taps on the sink will cause water, not coffee, to stream out. We have expectations of objects based on how we use them in the real world, or even how we've used them in games before. Deviating from this expected use will surprise the player.
The problem with surprise is that it hurts the player's ability to reason about the game. A foundation of logic has been erased, increasing the difficulty in finding associations between objects and deducing how to use items. The player will find the game illogical.
For example, it might be cute that sticking a sausage in a light socket cooks it, but that'd be an extremely surprising result. The player would not think of this possibility, and somehow stumble upon it, would say the puzzle was illogical and decry the game as unfair.
The law of least surprise is related to affordances. If an object looks like it should be able to do something, then a player will expect it to work that way.
There's a potential exception to this rule, when the surprise is the core mechanic of the puzzle. For example, if a door knob is placed on the wrong side of a door, where the player must discover to open it from the other side.
This would still be out-of-place in a detective theme, but would blend well into a funhouse theme. In this sense, it's not an except to the rule. A player in a funhouse will not be overly surprised by the door.
Another example is a player using a controller to move a robot through a maze. The controller, a standard video game controller, doesn't respond normally: the directions don't line up. This will be surprising. If this is the puzzle it might be forgiven, but in this case it makes sense to create a controller for which the player has no expectations instead. Use an alien layout without labels, or with lables that have no common semantics.
This law is mostly considered with respect to interactions with individual puzzle pieces. Larger scale changes, and deviations in aspects like theme, are covered under breaking expectations.
If you have any questions, need an example, or want clarification, then let me know. Ask on Discord or Twitter.
Assume everything in this reference is a working draft, there's prone to be some mistakes and inconsistencies. I figure it's best to publish and get feedback rather than write for years in secret. The terms will change, the structure will shift, and the bugs will be chased out. It'll take a while.