Internet recovery of 2015 MacBook Pro fails due to unavailability of Yosemite I recently purchased a second-hand 2015 13" MacBook Pro.  It came with High Sierra installed, but I wanted to make sure the system was completely clean (in case it had been compromised), so I:


Booted into internet recovery mode by restarting and pressing ⌘⌥R.
Used Disk Utility to erase the entire internal drive.  Unlike the internal recovery partition, internet recovery did not allow me to format it as APFS, so I chose HFS+ Journaled instead.
Attempted to use the "Reinstall OS X" option to do just that.


The installer was for Yosemite; that would be just fine with me (I can upgrade later).  After clicking through the licence agreement, selecting the target drive, and clicking "Install" I was prompted for my Apple ID and password to log into the app store, after which I received the following error message:


  This item is temporarily unavailable.  Please try again later.


(Needless to say, trying again later has not helped.)

I am pretty sure the problem is that I never "purchased" Yosemite; by the time I went to install it on a previous machine only El Capitan was available in the app store, and unfortunately there seems to be no way to retroactively "purchase" Yosemite, which is a bit of a problem in this case.

How can get macOS installed on this machine again—ideally without needing another machine (both because it is inconvenient, and because of the risk that the other machine might be compromised)?

(I am not too fussy about which version I get, since I probably want High Sierra in the end and can upgrade easily enough.)
You are correct - the issue you have is that Yosemite is not in your Purchased history.

With your MBP and its history, you should have three options open to you:


commandR to reinstall the latest macOS that was installed on your Mac, without upgrading to a later version 
optioncommandR to upgrade to the latest macOS that is compatible with your Mac
shiftoptioncommandR to reinstall the macOS that came with your Mac, or the version closest to it that is still available1


1 That third option is a new option only available when macOS Sierra 10.12.4 or above has been installed.

Obviously we can't be 100% sure what version of macOS was pre-installed when new, but it most likely would have been Yosemite 10.10.2.

I would try rebooting your MBP again using each of the above combinations one by one to test what happens, as it may be you can successfully reinstall macOS with one of them.

Let me know how you go.