Properly handle errors in the metadata endpoint