That error is usually because your Apple ID isn't associated with whatever version of OS X you're trying to install, you need to "own" the OS X version before you can do a reinstall of it.
IIRC, you can do it from the reinstallation screen, there should be an "Online Help" button (or something to that effect) that will open up Safari. Once there, you just go to iCloud, login with your Apple ID, and that should associate your account with whatever version of OS X you're trying to install (at least, this fixed an issue I had with an older Macbook, but should be the same).