Measuring the barrier potential of a p-n junction

An ordinary voltmeter has finite input impedance which simply means that, to measure a voltage across, there must be some (tiny) current through the voltmeter.

Thus, to measure the built-in potential of a diode with a voltmeter would require that the built-in potential 'drive' a (tiny) current through the voltmeter.

But that would require that the diode, a passive device, is an energy source!

Yes, the power would be tiny but one could, in principle, leave the diode connected to the voltmeter for an arbitrarily long time and thus, extract arbitrarily large energy from the diode.

Further reading: Why isn't there a potential difference across a disconnected diode?