"Retry Comfirmed" any ideas what could be causing this?

Does anyone have any idea why this could be happening?

It doesn’t seem to affect anything but it would be useful to understand why this occurs!

i have attached a code snippet of the offending code:

void pirEvent()
{
pinMode(GPIO2,OUTPUT);
Serial.println("PIR");
int time_now = millis();
int EARLY_BREAK = 0;
int events = 0;
int lastRefreshTime = 1;
int sleeptime = 0;
Time_Section = 0;
int MINUTES  = (60*MINUTES_INPUT*1000);
while(millis() < time_now + MINUTES){
  uint8_t val = digitalRead(GPIO5);
  delay(1000);
  if(millis() >= (time_now + (lastRefreshTime * SECONDS_15)))
  {
    if (events < THRESHHOLD){
      
      Serial.println("Not Occupied");
      if (lastRefreshTime > 1){
        EARLY_BREAK = 1;
        Time_Section = lastRefreshTime;
        break;
      }
      
      else{
 
        break;
      }

      
    }
    else {
      Serial.println("Still Occupied");
      lastRefreshTime += 1;
      events = 0;
      Serial.println(lastRefreshTime);
      if (lastRefreshTime == 2) {
        PACKET = 1;
        publish();
      }
    }
  }
  else{
        if (val == HIGH) {
      events = events +1;
    };
    
  }
  };
  if(EARLY_BREAK == 1){
      PACKET = 1;
      NEW_PACKET = 2;
      publish();
    }
  else{ if (lastRefreshTime != 1){
      Serial.println(lastRefreshTime);
          Serial.println("PIR TIMEOUT");
      PACKET = 1;
      Time_Section = lastRefreshTime;
      NEW_PACKET = 3;
      publish();
  }
    }
}
void publish(){
  prepareTxFrame( appPort );
  LoRaWAN.send();
  PACKET = 0;
  NEW_PACKET = 0;
}