DevNonce has already been used - i know that is a no new topic


I don’t know if it’s the correct section and before asking I tried to do some research but nothing was helpful for my problem.

I’ve been going crazy for days with “DevNonce has already been used”.

Given all those indicated in terms of security, I have in a laboratory environment, a local installation of chirpstack server (4.8.1) and a gateway (raspberry) with ChirpStack Gateway OS 4.3.2 Base.

I have some devices on which i need to develop various firmware and therefore variations in the device references are necessary for the tests.

I’m going crazy on the error stated above. how can I solve it?

For info:

I use OTAA activation and LoraWan version 1.1.0
appkey - does not vary
netkey - does not vary
Join EUI - does not vary
on the same device I can change the Device EUI due to testing needs

The “Flust OTAA device nonces” function does not resolve my problem.

Where am I wrong / what can I do? I’m sure I’m missing something.

thanks in advance.

ChirpStack is doing the right things.

For LoRaWAN 1.1.0, the DevNonce must be increased by 1 every join (even after a reboot).
In a reboot, the DevNonce must increases by 1 from last join.

Hence, your firmware MUST do session persistence across reboots.

If you use RadioLib for the firmware, you need to implement Session persistence.

You can take a look at the example code in the top of the below URL.

BTW, after you do a flash of the firmware, the session persistence is gone. So you have to Clear DevNonce in ChirpStack.


thanks for the very quick response.
I am aligned with what you wrote, therefore either something in my code is not working as I think or I am doing something wrong on the ChirpStack side.

When you say, you have to delete DevNonce in ChirpStack, does this mean using the “Flust OTAA device nonces” button? Otherwise how do you do it?

What I do is:

  • flash a new firmware, this operation remove also persistence data.
  • use “Flust OTAA device nonces”.
    but the problem arises.

sometime i need to change “Device EUI”, could be this operation that invalid the proces?

Thanss, Davide

May be you can screenshot the Device > LoRaWAN frames > Select JoinRequest > Check for value of devnonce in the right detail menu.

Do a few times with different Join Request, so we can see what is the value of the devnonce?

BTW, which LoRaWAN library are you using?


sorry for the delay in answering.
Let me know if this is the information you needed.

I attach some images, I hope they are explanatory.
The images sequence (03-24) is repeated infinitely, the number of dev_nonce is always 62.

I use the RadioLib 6.6.0 library

Thanks, Davide

02 - events - join

04 - events - log

I saw the first one is JoinAccept. Means OK.

For RadioLib, I recommend to put in Persistence code.
There are example code for esp32 and esp8266.

I have tried before with esp32+Radiolib+ChirpStack.
Without persistence code, after Flush the DevNonce, the node will be able to join ONCE with DevNonce=0.
After that, if you reboot the node, it can not join anymore as new DevNonce=0 is no longer accepted.

first of all, thanks for your support.
Formally i have done all you write for radiollib and persistence.
After last message, i tried to re-flash my dev board 2/3 times and … now all seem to be right.
I have change nothing, same firmware, same process, same steps.
i really don’t understand, i’m sure that i’m doing somethings wrong.


1 Like

Yeah, glad the problem is solved. :smiley: