lib: handle DatabaseModifiedError in _n_message_ensure_metadata