Race condition for restic init has confusing consequences
Output of restic version
Repository was created with 0.18.0. Opening behaviour is unchanged in 0.18.1.
What backend/service did you use to store the repository?
rest-server
Problem description / Steps to reproduce
When two clients run restic init within the same second, we get a repository with two key files. It is however not deterministic if restic will use the correct key when opening the repository. In my case, I could run all restic commands on the host running the rest-server, but all other clients would pick the bad key and abort.
server# restic key list --no-cache -r REDACTED
ID User Host Created
----------------------------------------------------------------------------------
7c25c29e root rocketchat01-osl3.REDACTED.c.bitbit.net 2026-01-20 02:32:03
*a0cc429e root jitsi01-osl3.REDACTED.c.bitbit.net 2026-01-20 02:32:03
----------------------------------------------------------------------------------client# restic key list --no-cache -r REDACTED
Fatal: config or key 7c25c29e6d0ea0358b7a403f3495e517f350ff5ca53ab5f86ff7030e4723e865 is damaged: ciphertext verification failedExpected behavior
Ideally, one of the restic init should abort rather than stomp over the config file of the other. This might require a patch to rest-server?
But even so restic itself should try the other key file (it does stat the file, I do not know how it chooses which file to use), and emit a diagnostic about the other key file being corrupt.
Actual behavior
Actual behaviour is that restic aborts with an error on some clients of the repo.
Do you have any idea what may have caused this?
init commands happened in the same second. from the key files:
7c25c29e6d0ea0358b7a403f3495e517f350ff5ca53ab5f86ff7030e4723e865:
{"created":"2026-01-20T02:32:03.963818563+01:00","username":"root","hostname":"rocketchat01-osl3.REDACTED.c.bitbit.net","kdf":"scrypt","N":32768,"r":8,"p":5,"salt":"…","data":"…"}a0cc429e76ed667663238b2fc4224be7cacf96eb94827025945697c122b7c895:
{"created":"2026-01-20T02:32:03.875984769+01:00","username":"root","hostname":"jitsi01-osl3.REDACTED.c.bitbit.net","kdf":"scrypt","N":32768,"r":8,"p":5,"salt":"…","data":"…"}Did restic help you today? Did it make you happy in any way?
Restic is great!
Source: restic/restic