When a backup fails in the middle of the night, you need a problem map. This episode teaches debugging with `RESTIC_DEBUG` and `--verbose`, handling common cases like repository lock, S3 timeout, and wrong password, then practicing disaster recovery with a lost-file simulation and recovery from a corrupted repository.

All episodes so far have built a system that runs smoothly. Episode 16 covers when nothing runs smoothly — because in real operations, that is guaranteed to happen. A backup fails at 3 AM, a restore does not find the file, or the repository is "locked".
The key: methodical diagnosis and drills done in advance, not panic in the moment.
The verbosity level climbs from -v up to -vvvv:
restic backup /data -vv-vv shows every processed file and the speed — useful for confirming the backup actually works or finding wrong path patterns.
For problems that need internal details (HTTP requests, chunking, keys):
RESTIC_DEBUG=1 restic backup /dataThe debug log shows the internal trace including backend URLs and HTTP statuses. Don't run it permanently — only while investigating; the output can be very large.
unable to create lock in backend: repository is already locked by ...Another backup/prune process has not finished. Solution: wait for the process, or if it is clearly stuck (e.g. a dropped connection), remove the lock deliberately:
restic list locks
restic unlockrestic unlock removes locks that are no longer valid. Be careful: don't unlock while another process is genuinely still running — it can damage the repository.
unable to open repository at s3:...
request failed: AccessDeniedCheck in order: credentials (AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY), bucket name, region, and endpoint version. Add timeouts via backend-specific options:
restic -o s3.list-objects-v1=true -o s3.connections=8 backup /datawrong password or no key foundUsually a typo or an unexported env. Check with restic cat config, which requires the password:
restic cat config && echo "password OK"If you truly forgot it, there is no way back — which is why episodes 3 and 13 stressed backing up the passphrase.
Recovery is only reliable if it has been practiced. A full simulation:
rm -rf /home/user/Documents
restic snapshots
restic restore latest --target /tmp/restore \
--path /home/user/Documents
mv /tmp/restore/home/user/Documents /home/user/Documents
diff -r /home/user/Documents /tmp/restore/home/user/DocumentsThe key: run it periodically in a test environment, record the duration (your RTO!), and also simulate the off-site backend (restore from S3/rest-server) — not just from the local repo.
When restic check reports missing blobs or hash mismatches (episode 11):
restic check and note the affected files/snapshots.restic repair index to fix the index, or restic check --read-data-subset to find specific corrupt blobs.restic repair indexImportant
There is no restic repair that recovers truly lost blobs — that data is gone. Real recovery comes from the source data that still exists + re-backing up. A corrupted repository is the strongest argument for a dual-backend strategy (episode 7).
-vv for backup details; RESTIC_DEBUG=1 for internal logs.restic list locks → restic unlock only when you are sure the process is dead.restic cat config — and don't forget it.In the next episode, episode 17, we refresh version knowledge: restic 0.19.x & the latest features — what 0.19.1 (Jul 2026) and 0.19.0 (Jun 2026) bring, the journey from 0.17 (2024) and 0.18 (2025) like zstd compression and lock-free index, and how to upgrade safely.