Install Mavericks via an HD partition
You're getting the error message because OS X Mavericks isn't available for download by the Recovery HD anymore, deleted in favor of Yosemite. Your best bet is to use Internet Recovery. Make sure you're on a decent Internet connection (Ethernet is best, if possible) and follow these instructions:


Immediately after hearing the Mac boot chime, hold down Command+Option+R – if you see the Apple logo you waited too long and need to reboot and try again
Eventually, you’ll see the familiar “OS X Utilities” screen, choose “Reinstall OS X” to begin the re-installation process of the Mac operating system
Select the destination and complete the re-installation (or installation) of OS X as usual


Source