Migration from QUIC_BUG to QUIC_BUG_V2(bug_id).

Per go/gfe-bug-improvements GFE_BUGs are getting stable IDs to allow for monitoring and alerting. Existing QUIC_BUG instances are changed to have quic_bug_n_m ID, where n is unique for each file, and m is a counter within each file, so we get QUIC_BUG_V2(quic_bug_123_2)

PiperOrigin-RevId: 362122938
Change-Id: I70302c8b7fa7a97d58854348195c6e534d7f65ce
diff --git a/quic/core/quic_network_blackhole_detector.cc b/quic/core/quic_network_blackhole_detector.cc
index e65013f..66e60a9 100644
--- a/quic/core/quic_network_blackhole_detector.cc
+++ b/quic/core/quic_network_blackhole_detector.cc
@@ -80,8 +80,8 @@
   blackhole_deadline_ = blackhole_deadline;
   path_mtu_reduction_deadline_ = path_mtu_reduction_deadline;
 
-  QUIC_BUG_IF(blackhole_deadline_.IsInitialized() &&
-              blackhole_deadline_ != GetLastDeadline())
+  QUIC_BUG_IF_V2(quic_bug_12708_1, blackhole_deadline_.IsInitialized() &&
+                                       blackhole_deadline_ != GetLastDeadline())
       << "Blackhole detection deadline should be the last deadline.";
 
   UpdateAlarm();
diff --git a/quic/core/quic_packet_creator.cc b/quic/core/quic_packet_creator.cc
index b374077..8b8bfce 100644
--- a/quic/core/quic_packet_creator.cc
+++ b/quic/core/quic_packet_creator.cc
@@ -46,7 +46,7 @@
     case ENCRYPTION_ZERO_RTT:
       return ZERO_RTT_PROTECTED;
     case ENCRYPTION_FORWARD_SECURE:
-      QUIC_BUG
+      QUIC_BUG_V2(quic_bug_12398_1)
           << "Try to derive long header type for packet with encryption level: "
           << level;
       return INVALID_PACKET_TYPE;
@@ -171,8 +171,9 @@
 
   max_packet_length_ = length;
   max_plaintext_size_ = framer_->GetMaxPlaintextSize(max_packet_length_);
-  QUIC_BUG_IF(max_plaintext_size_ - PacketHeaderSize() <
-              MinPlaintextPacketSize(framer_->version()))
+  QUIC_BUG_IF_V2(quic_bug_12398_2,
+                 max_plaintext_size_ - PacketHeaderSize() <
+                     MinPlaintextPacketSize(framer_->version()))
       << "Attempted to set max packet length too small";
 }
 
@@ -424,13 +425,14 @@
               GetRetryTokenLengthLength(), GetLengthLength(), offset) ||
       latched_hard_max_packet_length_ > 0);
 
-  QUIC_BUG_IF(!HasRoomForStreamFrame(id, offset, data_size))
+  QUIC_BUG_IF_V2(quic_bug_12398_3,
+                 !HasRoomForStreamFrame(id, offset, data_size))
       << "No room for Stream frame, BytesFree: " << BytesFree()
       << " MinStreamFrameSize: "
       << QuicFramer::GetMinStreamFrameSize(framer_->transport_version(), id,
                                            offset, true, data_size);
 
-  QUIC_BUG_IF(data_size == 0 && !fin)
+  QUIC_BUG_IF_V2(quic_bug_12398_4, data_size == 0 && !fin)
       << "Creating a stream frame for stream ID:" << id
       << " with no data or fin.";
   size_t min_frame_size = QuicFramer::GetMinStreamFrameSize(
@@ -480,7 +482,7 @@
 }
 
 void QuicPacketCreator::OnSerializedPacket() {
-  QUIC_BUG_IF(packet_.encrypted_buffer == nullptr);
+  QUIC_BUG_IF_V2(quic_bug_12398_5, packet_.encrypted_buffer == nullptr);
 
   SerializedPacket packet(std::move(packet_));
   ClearPacket();
@@ -498,7 +500,7 @@
   packet_.has_ack_frequency = false;
   packet_.has_message = false;
   packet_.fate = SEND_TO_WRITER;
-  QUIC_BUG_IF(packet_.release_encrypted_buffer != nullptr)
+  QUIC_BUG_IF_V2(quic_bug_12398_6, packet_.release_encrypted_buffer != nullptr)
       << "packet_.release_encrypted_buffer should be empty";
   packet_.release_encrypted_buffer = nullptr;
   QUICHE_DCHECK(packet_.retransmittable_frames.empty());
@@ -512,9 +514,10 @@
     size_t padding_size,
     char* buffer,
     size_t buffer_len) {
-  QUIC_BUG_IF(packet.encryption_level != ENCRYPTION_INITIAL);
-  QUIC_BUG_IF(packet.nonretransmittable_frames.empty() &&
-              packet.retransmittable_frames.empty())
+  QUIC_BUG_IF_V2(quic_bug_12398_7,
+                 packet.encryption_level != ENCRYPTION_INITIAL);
+  QUIC_BUG_IF_V2(quic_bug_12398_8, packet.nonretransmittable_frames.empty() &&
+                                       packet.retransmittable_frames.empty())
       << "Attempt to serialize empty ENCRYPTION_INITIAL packet in coalesced "
          "packet";
   ScopedPacketContextSwitcher switcher(
@@ -595,7 +598,7 @@
   }
 
   // Create a Stream frame with the remaining space.
-  QUIC_BUG_IF(iov_offset == write_length && !fin)
+  QUIC_BUG_IF_V2(quic_bug_12398_9, iov_offset == write_length && !fin)
       << "Creating a stream frame with no data or fin.";
   const size_t remaining_data_size = write_length - iov_offset;
   size_t min_frame_size = QuicFramer::GetMinStreamFrameSize(
@@ -756,7 +759,8 @@
   ScopedSerializationFailureHandler handler(this);
 
   QUICHE_DCHECK_LT(0u, encrypted_buffer_len);
-  QUIC_BUG_IF(queued_frames_.empty() && pending_padding_bytes_ == 0)
+  QUIC_BUG_IF_V2(quic_bug_12398_10,
+                 queued_frames_.empty() && pending_padding_bytes_ == 0)
       << "Attempt to serialize empty packet";
   QuicPacketHeader header;
   // FillPacketHeader increments packet_number_.
@@ -840,7 +844,8 @@
 
 std::unique_ptr<SerializedPacket>
 QuicPacketCreator::SerializeConnectivityProbingPacket() {
-  QUIC_BUG_IF(VersionHasIetfQuicFrames(framer_->transport_version()))
+  QUIC_BUG_IF_V2(quic_bug_12398_11,
+                 VersionHasIetfQuicFrames(framer_->transport_version()))
       << "Must not be version 99 to serialize padded ping connectivity probe";
   RemoveSoftMaxPacketLength();
   QuicPacketHeader header;
@@ -878,7 +883,8 @@
 std::unique_ptr<SerializedPacket>
 QuicPacketCreator::SerializePathChallengeConnectivityProbingPacket(
     const QuicPathFrameBuffer& payload) {
-  QUIC_BUG_IF(!VersionHasIetfQuicFrames(framer_->transport_version()))
+  QUIC_BUG_IF_V2(quic_bug_12398_12,
+                 !VersionHasIetfQuicFrames(framer_->transport_version()))
       << "Must be version 99 to serialize path challenge connectivity probe, "
          "is version "
       << framer_->transport_version();
@@ -920,7 +926,8 @@
 QuicPacketCreator::SerializePathResponseConnectivityProbingPacket(
     const QuicCircularDeque<QuicPathFrameBuffer>& payloads,
     const bool is_padded) {
-  QUIC_BUG_IF(!VersionHasIetfQuicFrames(framer_->transport_version()))
+  QUIC_BUG_IF_V2(quic_bug_12398_13,
+                 !VersionHasIetfQuicFrames(framer_->transport_version()))
       << "Must be version 99 to serialize path response connectivity probe, is "
          "version "
       << framer_->transport_version();
@@ -991,7 +998,7 @@
     const bool is_padded,
     EncryptionLevel level) {
   if (payloads.empty()) {
-    QUIC_BUG
+    QUIC_BUG_V2(quic_bug_12398_14)
         << "Attempt to generate connectivity response with no request payloads";
     return 0;
   }
@@ -1052,7 +1059,7 @@
     return 0;
   }
   RemoveSoftMaxPacketLength();
-  QUIC_BUG_IF(coalesced.length() == 0)
+  QUIC_BUG_IF_V2(quic_bug_12398_15, coalesced.length() == 0)
       << "Attempt to serialize empty coalesced packet";
   size_t packet_length = 0;
   if (coalesced.initial_packet() != nullptr) {
@@ -1194,8 +1201,9 @@
 
 bool QuicPacketCreator::ConsumeRetransmittableControlFrame(
     const QuicFrame& frame) {
-  QUIC_BUG_IF(IsControlFrame(frame.type) && !GetControlFrameId(frame) &&
-              frame.type != PING_FRAME)
+  QUIC_BUG_IF_V2(quic_bug_12398_16, IsControlFrame(frame.type) &&
+                                        !GetControlFrameId(frame) &&
+                                        frame.type != PING_FRAME)
       << "Adding a control frame with no control frame id: " << frame;
   QUICHE_DCHECK(QuicUtils::IsRetransmittableFrame(frame.type)) << frame;
   MaybeBundleAckOpportunistically();
@@ -1229,7 +1237,7 @@
   bool has_handshake = QuicUtils::IsCryptoStreamId(transport_version(), id);
   MaybeBundleAckOpportunistically();
   bool fin = state != NO_FIN;
-  QUIC_BUG_IF(has_handshake && fin)
+  QUIC_BUG_IF_V2(quic_bug_12398_17, has_handshake && fin)
       << "Handshake packets should never send a fin";
   // To make reasoning about crypto frames easier, we don't combine them with
   // other retransmittable frames in a single packet.
@@ -1441,8 +1449,9 @@
          "generator tries to send ACK frame.";
   // MaybeBundleAckOpportunistically could be called nestedly when sending a
   // control frame causing another control frame to be sent.
-  QUIC_BUG_IF(GetQuicReloadableFlag(quic_single_ack_in_packet2) &&
-              !frames.empty() && has_ack())
+  QUIC_BUG_IF_V2(quic_bug_12398_18,
+                 GetQuicReloadableFlag(quic_single_ack_in_packet2) &&
+                     !frames.empty() && has_ack())
       << "Trying to flush " << frames << " when there is ACK queued";
   for (const auto& frame : frames) {
     QUICHE_DCHECK(frame.type == ACK_FRAME || frame.type == STOP_WAITING_FRAME);
@@ -2005,7 +2014,8 @@
     QuicPacketCreator* creator,
     QuicSocketAddress address)
     : creator_(creator), old_peer_address_(creator_->packet_.peer_address) {
-  QUIC_BUG_IF(!creator_->packet_.peer_address.IsInitialized())
+  QUIC_BUG_IF_V2(quic_bug_12398_19,
+                 !creator_->packet_.peer_address.IsInitialized())
       << "Context is used before seralized packet's peer address is "
          "initialized.";
   creator_->SetDefaultPeerAddress(address);
@@ -2089,7 +2099,7 @@
     return false;
   }
   bool success = AddPaddedSavedFrame(frame, NOT_RETRANSMISSION);
-  QUIC_BUG_IF(!success);
+  QUIC_BUG_IF_V2(quic_bug_12398_20, !success);
   return true;
 }
 
diff --git a/quic/core/quic_path_validator.cc b/quic/core/quic_path_validator.cc
index ec2c902..8ba3e3d 100644
--- a/quic/core/quic_path_validator.cc
+++ b/quic/core/quic_path_validator.cc
@@ -47,7 +47,8 @@
   }
 
   QUIC_DVLOG(1) << "Match PATH_RESPONSE received on " << self_address;
-  QUIC_BUG_IF(!path_context_->self_address().IsInitialized())
+  QUIC_BUG_IF_V2(quic_bug_12402_1,
+                 !path_context_->self_address().IsInitialized())
       << "Self address should have been known by now";
   if (self_address != path_context_->self_address()) {
     QUIC_DVLOG(1) << "Expect the response to be received on "
diff --git a/quic/core/quic_sent_packet_manager.cc b/quic/core/quic_sent_packet_manager.cc
index b1970c8..1b81ef6 100644
--- a/quic/core/quic_sent_packet_manager.cc
+++ b/quic/core/quic_sent_packet_manager.cc
@@ -179,7 +179,7 @@
 
   if (config.HasClientSentConnectionOption(kPTOS, perspective)) {
     if (!pto_enabled_) {
-      QUIC_PEER_BUG
+      QUIC_PEER_BUG_V2(quic_peer_bug_12552_1)
           << "PTO is not enabled when receiving PTOS connection option.";
       pto_enabled_ = true;
       max_probe_packets_per_pto_ = 1;
@@ -639,9 +639,11 @@
       unacked_packets_.GetMutableTransmissionInfo(packet_number);
   // A previous RTO retransmission may cause connection close; packets without
   // retransmittable frames can be marked for loss retransmissions.
-  QUIC_BUG_IF(transmission_type != LOSS_RETRANSMISSION &&
-              transmission_type != RTO_RETRANSMISSION &&
-              !unacked_packets_.HasRetransmittableFrames(*transmission_info))
+  QUIC_BUG_IF_V2(
+      quic_bug_12552_2,
+      transmission_type != LOSS_RETRANSMISSION &&
+          transmission_type != RTO_RETRANSMISSION &&
+          !unacked_packets_.HasRetransmittableFrames(*transmission_info))
       << "packet number " << packet_number
       << " transmission_type: " << transmission_type << " transmission_info "
       << transmission_info->DebugString();
@@ -971,7 +973,7 @@
 
 void QuicSentPacketManager::RetransmitRtoPackets() {
   QUICHE_DCHECK(!pto_enabled_);
-  QUIC_BUG_IF(pending_timer_transmission_count_ > 0)
+  QUIC_BUG_IF_V2(quic_bug_12552_3, pending_timer_transmission_count_ > 0)
       << "Retransmissions already queued:" << pending_timer_transmission_count_;
   // Mark two packets for retransmission.
   std::vector<QuicPacketNumber> retransmissions;
@@ -1001,7 +1003,7 @@
     MarkForRetransmission(retransmission, RTO_RETRANSMISSION);
   }
   if (retransmissions.empty()) {
-    QUIC_BUG_IF(pending_timer_transmission_count_ != 0);
+    QUIC_BUG_IF_V2(quic_bug_12552_4, pending_timer_transmission_count_ != 0);
     // No packets to be RTO retransmitted, raise up a credit to allow
     // connection to send.
     QUIC_CODE_COUNT(no_packets_to_be_rto_retransmitted);
@@ -1018,7 +1020,8 @@
     // Find out the packet number space to send probe packets.
     if (!GetEarliestPacketSentTimeForPto(&packet_number_space)
              .IsInitialized()) {
-      QUIC_BUG_IF(unacked_packets_.perspective() == Perspective::IS_SERVER)
+      QUIC_BUG_IF_V2(quic_bug_12552_5,
+                     unacked_packets_.perspective() == Perspective::IS_SERVER)
           << "earlist_sent_time not initialized when trying to send PTO "
              "retransmissions";
       return;
@@ -1419,7 +1422,7 @@
   QUICHE_DCHECK(pto_enabled_);
   if (rtt_stats_.smoothed_rtt().IsZero()) {
     // Respect kMinHandshakeTimeoutMs to avoid a potential amplification attack.
-    QUIC_BUG_IF(rtt_stats_.initial_rtt().IsZero());
+    QUIC_BUG_IF_V2(quic_bug_12552_6, rtt_stats_.initial_rtt().IsZero());
     return std::max(
                pto_multiplier_without_rtt_samples_ * rtt_stats_.initial_rtt(),
                QuicTime::Delta::FromMilliseconds(kMinHandshakeTimeoutMs)) *
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc
index 5296162..065baaf 100644
--- a/quic/core/quic_session.cc
+++ b/quic/core/quic_session.cc
@@ -364,7 +364,7 @@
 }
 
 void QuicSession::OnGoAway(const QuicGoAwayFrame& /*frame*/) {
-  QUIC_BUG_IF(version().UsesHttp3())
+  QUIC_BUG_IF_V2(quic_bug_12435_1, version().UsesHttp3())
       << "gQUIC GOAWAY received on version " << version();
 
   transport_goaway_received_ = true;
@@ -423,7 +423,7 @@
     stream->OnConnectionClosed(frame.quic_error_code, source);
     auto it = stream_map_.find(id);
     if (it != stream_map_.end()) {
-      QUIC_BUG_IF(!it->second->IsZombie())
+      QUIC_BUG_IF_V2(quic_bug_12435_2, !it->second->IsZombie())
           << ENDPOINT << "Non-zombie stream " << id
           << " failed to close under OnConnectionClosed";
     }
@@ -757,7 +757,7 @@
     if (was_zero_rtt_rejected_ && !OneRttKeysAvailable()) {
       QUICHE_DCHECK(version().UsesTls() &&
                     perspective() == Perspective::IS_CLIENT);
-      QUIC_BUG_IF(type == NOT_RETRANSMISSION)
+      QUIC_BUG_IF_V2(quic_bug_12435_3, type == NOT_RETRANSMISSION)
           << ENDPOINT << "Try to send new data on stream " << id
           << "before 1-RTT keys are available while 0-RTT is rejected.";
     } else {
@@ -1011,10 +1011,10 @@
   QUIC_DVLOG_IF(1, stream_was_draining)
       << ENDPOINT << "Stream " << stream_id << " was draining";
   if (stream_was_draining) {
-    QUIC_BUG_IF(num_draining_streams_ == 0);
+    QUIC_BUG_IF_V2(quic_bug_12435_4, num_draining_streams_ == 0);
     --num_draining_streams_;
     if (!IsIncomingStream(stream_id)) {
-      QUIC_BUG_IF(num_outgoing_draining_streams_ == 0);
+      QUIC_BUG_IF_V2(quic_bug_12435_5, num_outgoing_draining_streams_ == 0);
       --num_outgoing_draining_streams_;
     }
     // Stream Id manager has been informed with draining streams.
@@ -1105,7 +1105,7 @@
   // In the second config setting, 1-RTT keys are guaranteed to be available.
   if (version().UsesTls() && is_configured_ &&
       connection_->encryption_level() != ENCRYPTION_FORWARD_SECURE) {
-    QUIC_BUG
+    QUIC_BUG_V2(quic_bug_12435_6)
         << ENDPOINT
         << "1-RTT keys missing when config is negotiated for the second time.";
     connection_->CloseConnection(
@@ -1584,9 +1584,10 @@
   if (reset_encryption_level) {
     connection()->SetDefaultEncryptionLevel(ENCRYPTION_ZERO_RTT);
   }
-  QUIC_BUG_IF(IsEncryptionEstablished() &&
-              (connection()->encryption_level() == ENCRYPTION_INITIAL ||
-               connection()->encryption_level() == ENCRYPTION_HANDSHAKE))
+  QUIC_BUG_IF_V2(quic_bug_12435_7,
+                 IsEncryptionEstablished() &&
+                     (connection()->encryption_level() == ENCRYPTION_INITIAL ||
+                      connection()->encryption_level() == ENCRYPTION_HANDSHAKE))
       << "Encryption is established, but the encryption level " << level
       << " does not support sending stream data";
 }
@@ -1612,7 +1613,7 @@
     case ENCRYPTION_HANDSHAKE:
       break;
     case ENCRYPTION_FORWARD_SECURE:
-      QUIC_BUG_IF(!config_.negotiated())
+      QUIC_BUG_IF_V2(quic_bug_12435_8, !config_.negotiated())
           << ENDPOINT << "Handshake confirmed without parameter negotiation.";
       connection()->mutable_stats().handshake_completion_time =
           connection()->clock()->ApproximateNow();
@@ -1624,9 +1625,10 @@
 
 void QuicSession::OnTlsHandshakeComplete() {
   QUICHE_DCHECK_EQ(PROTOCOL_TLS1_3, connection_->version().handshake_protocol);
-  QUIC_BUG_IF(!GetCryptoStream()->crypto_negotiated_params().cipher_suite)
+  QUIC_BUG_IF_V2(quic_bug_12435_9,
+                 !GetCryptoStream()->crypto_negotiated_params().cipher_suite)
       << ENDPOINT << "Handshake completes without cipher suite negotiation.";
-  QUIC_BUG_IF(!config_.negotiated())
+  QUIC_BUG_IF_V2(quic_bug_12435_10, !config_.negotiated())
       << ENDPOINT << "Handshake completes without parameter negotiation.";
   connection()->mutable_stats().handshake_completion_time =
       connection()->clock()->ApproximateNow();
diff --git a/quic/core/quic_stream.cc b/quic/core/quic_stream.cc
index 50e0776..3a4b113 100644
--- a/quic/core/quic_stream.cc
+++ b/quic/core/quic_stream.cc
@@ -176,7 +176,7 @@
       (kMaxStreamLength - frame.offset < frame.data_length);
   if (is_stream_too_long) {
     // Close connection if stream becomes too long.
-    QUIC_PEER_BUG
+    QUIC_PEER_BUG_V2(quic_peer_bug_12570_1)
         << "Receive stream frame reaches max stream length. frame offset "
         << frame.offset << " length " << frame.data_length;
     OnUnrecoverableError(QUIC_STREAM_LENGTH_OVERFLOW,
@@ -474,7 +474,7 @@
       MaybeIncreaseHighestReceivedOffset(frame.offset + frame_payload_size)) {
     // As the highest received offset has changed, check to see if this is a
     // violation of flow control.
-    QUIC_BUG_IF(!flow_controller_.has_value())
+    QUIC_BUG_IF_V2(quic_bug_12570_2, !flow_controller_.has_value())
         << ENDPOINT << "OnStreamFrame called on stream without flow control";
     if ((flow_controller_.has_value() &&
          flow_controller_->FlowControlViolation()) ||
@@ -542,7 +542,7 @@
   }
 
   MaybeIncreaseHighestReceivedOffset(frame.byte_offset);
-  QUIC_BUG_IF(!flow_controller_.has_value())
+  QUIC_BUG_IF_V2(quic_bug_12570_3, !flow_controller_.has_value())
       << ENDPOINT << "OnStreamReset called on stream without flow control";
   if ((flow_controller_.has_value() &&
        flow_controller_->FlowControlViolation()) ||
@@ -631,7 +631,8 @@
     bool fin,
     QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) {
   if (session()->use_write_or_buffer_data_at_level()) {
-    QUIC_BUG_IF(QuicUtils::IsCryptoStreamId(transport_version(), id_))
+    QUIC_BUG_IF_V2(quic_bug_12570_4,
+                   QuicUtils::IsCryptoStreamId(transport_version(), id_))
         << ENDPOINT
         << "WriteOrBufferData is used to send application data, use "
            "WriteOrBufferDataAtLevel to send crypto data.";
@@ -880,7 +881,7 @@
   }
 
   if (!session()->version().UsesHttp3()) {
-    QUIC_BUG_IF(error == QUIC_STREAM_NO_ERROR);
+    QUIC_BUG_IF_V2(quic_bug_12570_5, error == QUIC_STREAM_NO_ERROR);
     stop_sending_sent_ = true;
     CloseReadSide();
   }
@@ -915,8 +916,8 @@
   QUICHE_DCHECK(read_side_closed_ && write_side_closed_);
 
   if (!fin_sent_ && !rst_sent_) {
-    QUIC_BUG_IF(session()->connection()->connected() &&
-                session()->version().UsesHttp3())
+    QUIC_BUG_IF_V2(quic_bug_12570_6, session()->connection()->connected() &&
+                                         session()->version().UsesHttp3())
         << "The stream should've already sent RST in response to "
            "STOP_SENDING";
     // For flow control accounting, tell the peer how many bytes have been
@@ -1008,7 +1009,7 @@
     return;
   }
   if (!flow_controller_.has_value()) {
-    QUIC_BUG
+    QUIC_BUG_V2(quic_bug_12570_7)
         << ENDPOINT
         << "AddBytesConsumed called on non-crypto stream without flow control";
     return;
@@ -1038,7 +1039,7 @@
     if (was_zero_rtt_rejected && new_offset < flow_controller_->bytes_sent()) {
       // The client is given flow control window lower than what's written in
       // 0-RTT. This QUIC implementation is unable to retransmit them.
-      QUIC_BUG_IF(perspective_ == Perspective::IS_SERVER)
+      QUIC_BUG_IF_V2(quic_bug_12570_8, perspective_ == Perspective::IS_SERVER)
           << "Server streams' flow control should never be configured twice.";
       OnUnrecoverableError(
           QUIC_ZERO_RTT_UNRETRANSMITTABLE,
@@ -1051,7 +1052,7 @@
       // In IETF QUIC, if the client receives flow control limit lower than what
       // was resumed from 0-RTT, depending on 0-RTT status, it's either the
       // peer's fault or our implementation's fault.
-      QUIC_BUG_IF(perspective_ == Perspective::IS_SERVER)
+      QUIC_BUG_IF_V2(quic_bug_12570_9, perspective_ == Perspective::IS_SERVER)
           << "Server streams' flow control should never be configured twice.";
       OnUnrecoverableError(
           was_zero_rtt_rejected ? QUIC_ZERO_RTT_REJECTION_LIMIT_REDUCED
diff --git a/quic/core/quic_stream_id_manager.cc b/quic/core/quic_stream_id_manager.cc
index 397eb71..11763ca 100644
--- a/quic/core/quic_stream_id_manager.cc
+++ b/quic/core/quic_stream_id_manager.cc
@@ -86,7 +86,7 @@
 
 void QuicStreamIdManager::SetMaxOpenIncomingStreams(
     QuicStreamCount max_open_streams) {
-  QUIC_BUG_IF(incoming_stream_count_ > 0)
+  QUIC_BUG_IF_V2(quic_bug_12413_1, incoming_stream_count_ > 0)
       << "non-zero incoming stream count " << incoming_stream_count_
       << " when setting max incoming stream to " << max_open_streams;
   QUIC_DLOG_IF(WARNING, incoming_initial_max_open_streams_ != max_open_streams)
@@ -113,7 +113,8 @@
 }
 
 void QuicStreamIdManager::SendMaxStreamsFrame() {
-  QUIC_BUG_IF(incoming_advertised_max_streams_ >= incoming_actual_max_streams_);
+  QUIC_BUG_IF_V2(quic_bug_12413_2, incoming_advertised_max_streams_ >=
+                                       incoming_actual_max_streams_);
   incoming_advertised_max_streams_ = incoming_actual_max_streams_;
   delegate_->SendMaxStreams(incoming_advertised_max_streams_, unidirectional_);
 }
@@ -138,7 +139,8 @@
 }
 
 QuicStreamId QuicStreamIdManager::GetNextOutgoingStreamId() {
-  QUIC_BUG_IF(outgoing_stream_count_ >= outgoing_max_streams_)
+  QUIC_BUG_IF_V2(quic_bug_12413_3,
+                 outgoing_stream_count_ >= outgoing_max_streams_)
       << "Attempt to allocate a new outgoing stream that would exceed the "
          "limit ("
       << outgoing_max_streams_ << ")";
diff --git a/quic/core/quic_stream_send_buffer.cc b/quic/core/quic_stream_send_buffer.cc
index 01a43fb..e2aff30 100644
--- a/quic/core/quic_stream_send_buffer.cc
+++ b/quic/core/quic_stream_send_buffer.cc
@@ -105,7 +105,7 @@
 bool QuicStreamSendBuffer::WriteStreamData(QuicStreamOffset offset,
                                            QuicByteCount data_length,
                                            QuicDataWriter* writer) {
-  QUIC_BUG_IF(current_end_offset_ < offset)
+  QUIC_BUG_IF_V2(quic_bug_12823_1, current_end_offset_ < offset)
       << "Tried to write data out of sequence. last_offset_end:"
       << current_end_offset_ << ", offset:" << offset;
   // The iterator returned from |interval_deque_| will automatically advance
@@ -264,7 +264,8 @@
 void QuicStreamSendBuffer::CleanUpBufferedSlices() {
   while (!interval_deque_.Empty() &&
          interval_deque_.DataBegin()->slice.empty()) {
-    QUIC_BUG_IF(interval_deque_.DataBegin()->offset > current_end_offset_)
+    QUIC_BUG_IF_V2(quic_bug_12823_2,
+                   interval_deque_.DataBegin()->offset > current_end_offset_)
         << "Fail to pop front from interval_deque_. Front element contained "
            "a slice whose data has not all be written. Front offset "
         << interval_deque_.DataBegin()->offset << " length "
diff --git a/quic/core/quic_trace_visitor.cc b/quic/core/quic_trace_visitor.cc
index cd5ea7f..5a9cfb7 100644
--- a/quic/core/quic_trace_visitor.cc
+++ b/quic/core/quic_trace_visitor.cc
@@ -77,7 +77,7 @@
       case MTU_DISCOVERY_FRAME:
       case STOP_WAITING_FRAME:
       case ACK_FRAME:
-        QUIC_BUG
+        QUIC_BUG_V2(quic_bug_12732_1)
             << "Frames of type are not retransmittable and are not supposed "
                "to be in retransmittable_frames";
         break;
diff --git a/quic/core/quic_unacked_packet_map.cc b/quic/core/quic_unacked_packet_map.cc
index be355ba..4e74839 100644
--- a/quic/core/quic_unacked_packet_map.cc
+++ b/quic/core/quic_unacked_packet_map.cc
@@ -140,8 +140,8 @@
   const SerializedPacket& packet = *mutable_packet;
   QuicPacketNumber packet_number = packet.packet_number;
   QuicPacketLength bytes_sent = packet.encrypted_length;
-  QUIC_BUG_IF(largest_sent_packet_.IsInitialized() &&
-              largest_sent_packet_ >= packet_number)
+  QUIC_BUG_IF_V2(quic_bug_12645_1, largest_sent_packet_.IsInitialized() &&
+                                       largest_sent_packet_ >= packet_number)
       << "largest_sent_packet_: " << largest_sent_packet_
       << ", packet_number: " << packet_number;
   QUICHE_DCHECK_GE(packet_number, least_unacked_ + unacked_packets_.size());
@@ -158,7 +158,7 @@
   largest_sent_largest_acked_.UpdateMax(packet.largest_acked);
 
   if (!measure_rtt) {
-    QUIC_BUG_IF(set_in_flight);
+    QUIC_BUG_IF_V2(quic_bug_12645_2, set_in_flight);
     info.state = NOT_CONTRIBUTING_RTT;
   }
 
@@ -289,8 +289,8 @@
 
 void QuicUnackedPacketMap::RemoveFromInFlight(QuicTransmissionInfo* info) {
   if (info->in_flight) {
-    QUIC_BUG_IF(bytes_in_flight_ < info->bytes_sent);
-    QUIC_BUG_IF(packets_in_flight_ == 0);
+    QUIC_BUG_IF_V2(quic_bug_12645_3, bytes_in_flight_ < info->bytes_sent);
+    QUIC_BUG_IF_V2(quic_bug_12645_4, packets_in_flight_ == 0);
     bytes_in_flight_ -= info->bytes_sent;
     --packets_in_flight_;