Improve error handling on metadata error.