Throw a useful error on invalid selector

Closes #296