Do not use the file name in errors unless it exists

Fixes #1182