Return a more helpful error message when an invalid refs path is provided

Fixes #240 and #242