Unexpected Downlink ID Changes in ChirpStack – Causes & Prevention?

Why Does Downlink ID Change in ChirpStack and How Can We Prevent It?

Context

We have a large number of devices connected to ChirpStack. Due to potential network issues, devices may attempt to join again on their own or enter the LOG state (often showing the “dev-nonce has already been used” error).

We also have a separate self-hosted server responsible for sending downlinks to ChirpStack and enqueuing them. On our platform, we track which device has which downlink enqueued by storing the downlink ID in our database.

Problem

When we receive events such as ACK or TXACK, we update the state of the downlink from QUEUED to SENT. However, sometimes the downlink ID changes, which disrupts our state tracking.

We are aware that activating a device will flush the downlink queue, and we already handle this scenario.

Questions

  1. What causes a downlink’s ID to change in ChirpStack?

  2. Is there a way to prevent the downlink ID from changing to ensure consistent tracking?

Any insights or recommendations would be greatly appreciated.

Thanks in advance!