The command sequence itself is sane and shouldn’t cause any problems. Most (if not all) restic commands are built such that one can’t accidentally break a backup repository. (Deleting lots of snapshots is still possible though).
That error message shows that the problem is totally different from what I’ve expected based on the high-level description: the problem isn’t specific to the commands you’ve used. Instead you’re seeing the B2 issues already reported in Restic hangs with B2 since 2021-10-01 and crash on unlock · Issue #3541 · restic/restic · GitHub .
Although it may sound strange, that is actually correct. The problem here is that restic doesn’t realize that the old lock file was already deleted on B2 and continues complaining. The lock mechanism still works nevertheless. However, it could leave lots of stale locks behind which you then have to remove using unlock
.