Why are lots of different moves usually considered equivalent in the opening, but not in the middlegame? When you go to websites like chess.com and analyze your games, you'll notice that most of the first moves are marked as being &quot;book moves&quot;—which I assume are considered equivalent to each other when it comes to engine evaluation, since they're just different ways you could play the game in its early stage, and you merely pick one without your move necessarily being &quot;wrong&quot; (unless it's a total blunder than doesn't belong to any sound opening, of course). For example, after 1. e4 e5 you could play 2. f4 or 2. Nf3, and the computer will tell you they're both top moves in this position without marking either of them as an inaccuracy or a mistake.
But why doesn't this happen in the middlegame? In pretty much all positions, the engine will always agree that there's one and only one move that is best for you. Yet the middle game is the most complex phase of the game, isn't it? So it's where I'd actually expect lots of moves to be fundamentally equivalent to each other, but instead the contrary happens.
For example, after 1. e4 e5 you could play 2. f4 or 2. Nf3, and the computer will tell you they're both top moves in this position without marking either of them as an inaccuracy or a mistake.

That's because there is a line of code in the program which says something like:
If (move is in book) then set move value = accurate
else call regular evaluation function
That line is there to stop the engine from wasting time trying to calculate. Instead it can just look up its book and pick an approved move.

But why doesn't this happen in the middlegame?

Because there is no &quot;book&quot; move. The engine does something completely different from the opening and tries to calculate the best move.

Yet the middle game is the most complex phase of the game, isn't it?

Not really. If there are 30 book moves in a Ruy Lopez Marshall Gambit line then moves 20 through 30 are likely for positions just as complex as for moves 20 through 30 in a different line where book ran out after 15 moves and the engine is calculating instead of looking up. Yet the computer can use its book for the Marshall and save calculating time and effort.

So it's where I'd actually expect lots of moves to be fundamentally equivalent to each other, but instead the contrary happens.

That doesn't make sense. If the engine is calculating each possible different move in a given complicated position then it makes perfect sense for them all to be different.
It is making calculations based on programmed algorithms. It is mot making a human evaluation of the position. The only time different possible moves are likely to have the exact same evaluation is when the engine calculates two different moves out to the exact same final result, like a draw or a checkmate.