Fix incorrect path in an error message

fixes #6492