In the given circuit of a regulated power supply, why is error computed twice, i.e., before and after isolation?
It doesn't. A1 at the secondary side computes the error, and transfers it to the primary side using the optocoupler, which is used to pull the Vref lower, to decrease the activity of the PWM circuit, which closes the loop. At the primary side, there is no comparing to any reference volatge, and the operation (coupling factor) of the optocouple is so variable that it would not make sense anyway.

What might confuse you is that OC1 interfaces to the PWM circuit via its Vref output. This is just a way of gradually shutting down the PWM circuit.