throw error on invalid metadata type