better error message for replacing metadata #894