Corrupted /var/lib/husarnet/notifications.json makes husarnet-daemon crash

Hi, Husarnet team.

I was investigating an issue in which a robot couldn’t connect to Husarnet, and I found that Husarnet seemed to fail to read /var/lib/husarnet/notifications.json.

The logs I saw were like this:


Jul 21 11:41:29 fastbot1 docker[2919]: 2026-07-21_09:41:29 INFO ngsocket fc94:...:54d0:9089 listening on 5582 
Jul 21 11:41:30 fastbot1 docker[2919]: libc++abi: terminating with uncaught exception of type nlohmann::detail::parse_error: [json.exception.parse_error.101] parse error at line 1, column 1: synt> 

Jul 21 11:41:30 fastbot1 docker[2919]: /usr/bin/husarnet-docker: line 146: 21 Aborted (core dumped) husarnet-daemon 

Jul 21 11:41:30 fastbot1 docker[2919]: husarnet-docker, line 1: Error 134 
Jul 21 11:41:31 fastbot1 systemd[1]: theconstruct.rrl.service: Main process exited, code=exited, status=134/n/a 
Jul 21 11:41:31 fastbot1 systemd[1]: theconstruct.rrl.service: Failed with result 'exit-code'.

With ls -l I could see that /var/lib/husarnet/notifications.json had 34 bytes, but using cat /var/lib/husarnet/notifications.json was not showing anything.

While in other robots, it also showed 34 bytes, but the content was {"announcements":[],"latest_id":0}.

With ChatGPT help, I could see that the broken file was filled with zeroes:

root@fastbot1:/var/lib/husarnet# od -An -tx1 -c notifications.json 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 * 
00 00
\0 \0

While in a working robot, I found:

root@fastbot3:/var/lib/husarnet# od -An -tx1 -c notifications.json 
7b 22 61 6e 6e 6f 75 6e 63 65 6d 65 6e 74 73 22 
{ " a n n o u n c e m e n t s " 
3a 5b 5d 2c 22 6c 61 74 65 73 74 5f 69 64 22 3a 
: [ ] , " l a t e s t _ i d " : 
30 7d 
0 }

I was able to make it work simply by replacing the broken content with:

{"announcements":[],"latest_id":0}

I don’t know if you have already fixed this in newer versions, but if not, I would consider resetting that `.json` file automatically if it is not a valid JSON file, instead of propagating the JSON exception, because restarting the robot or reinstalling husarnet didn’t seem to fix.

By the way, this is the first time I have detected this error.

Have a great day.

God bless you.

Hello @ralves,

Thank you so much for the report.
This is a bit unfortunate, we are still not ready to roll out new version of the Daemon and this can happen sometimes if there is network error.

Old daemon version will fetch http://app.husarnet.com/announcements.json on startup because earlier we had this way of pushing info to the clients. The file is there only for backward-compatibility, but if the server is down or some network condition happen it is not handled properly.

New daemon version does not look at this file at all, so it’s solved this way.

Restoring the file manually is actually the best DIY workaround if you ever hit this issue, so thank you for providing that.

Best regards!
ympek

1 Like