Fix damaged repo


#1

A backup was interrupted and left my repo in a damaged state. When I try to list snapshots, I get the following output:

restic ... snapshots -c
repository 2f0992a2 opened successfully, password is correct
Load(<snapshot/d7efe02e72>, 0, 0) returned error, retrying after 498.812741ms: trying to cache truncated file <snapshot/d7efe02e72>
Load(<snapshot/d7efe02e72>, 0, 0) returned error, retrying after 1.021521273s: trying to cache truncated file <snapshot/d7efe02e72>
Load(<snapshot/d7efe02e72>, 0, 0) returned error, retrying after 954.014797ms: trying to cache truncated file <snapshot/d7efe02e72>
Load(<snapshot/d7efe02e72>, 0, 0) returned error, retrying after 1.65238028s: trying to cache truncated file <snapshot/d7efe02e72>
Load(<snapshot/d7efe02e72>, 0, 0) returned error, retrying after 3.060367219s: trying to cache truncated file <snapshot/d7efe02e72>
Load(<snapshot/d7efe02e72>, 0, 0) returned error, retrying after 4.81477323s: trying to cache truncated file <snapshot/d7efe02e72>
Load(<snapshot/d7efe02e72>, 0, 0) returned error, retrying after 3.235347789s: trying to cache truncated file <snapshot/d7efe02e72>
Load(<snapshot/d7efe02e72>, 0, 0) returned error, retrying after 9.336100434s: trying to cache truncated file <snapshot/d7efe02e72>
Load(<snapshot/d7efe02e72>, 0, 0) returned error, retrying after 17.745175033s: trying to cache truncated file <snapshot/d7efe02e72>
Load(<snapshot/d7efe02e72>, 0, 0) returned error, retrying after 22.129445615s: trying to cache truncated file <snapshot/d7efe02e72>
could not load snapshot d7efe02e: load <snapshot/d7efe02e72>: invalid data returned
Load(<snapshot/eed517be07>, 0, 0) returned error, retrying after 529.608058ms: trying to cache truncated file <snapshot/eed517be07>
Load(<snapshot/eed517be07>, 0, 0) returned error, retrying after 833.858424ms: trying to cache truncated file <snapshot/eed517be07>
Load(<snapshot/eed517be07>, 0, 0) returned error, retrying after 946.027483ms: trying to cache truncated file <snapshot/eed517be07>
Load(<snapshot/eed517be07>, 0, 0) returned error, retrying after 885.911437ms: trying to cache truncated file <snapshot/eed517be07>
Load(<snapshot/eed517be07>, 0, 0) returned error, retrying after 2.68443448s: trying to cache truncated file <snapshot/eed517be07>
Load(<snapshot/eed517be07>, 0, 0) returned error, retrying after 4.287940257s: trying to cache truncated file <snapshot/eed517be07>
Load(<snapshot/eed517be07>, 0, 0) returned error, retrying after 5.954706836s: trying to cache truncated file <snapshot/eed517be07>
Load(<snapshot/eed517be07>, 0, 0) returned error, retrying after 7.015016023s: trying to cache truncated file <snapshot/eed517be07>
Load(<snapshot/eed517be07>, 0, 0) returned error, retrying after 11.87405628s: trying to cache truncated file <snapshot/eed517be07>
Load(<snapshot/eed517be07>, 0, 0) returned error, retrying after 14.459632823s: trying to cache truncated file <snapshot/eed517be07>
could not load snapshot eed517be: load <snapshot/eed517be07>: invalid data returned
ID        Date                 Host        Tags  
----------------------------------------------------------------------
89b4bd33  2017-09-04 20:39:51  reeb.local  
e2bd86ed  2017-09-04 21:02:56  reeb.local  
...
47a01f64  2018-07-02 10:49:45  reeb.local  
28aab6e1  2018-07-02 23:09:00  reeb.local  
----------------------------------------------------------------------
422 snapshots

This would be Ok, except that backup doesn’t actually work:

restic ... backup
repository 2f0992a2 opened successfully, password is correct
Load(<snapshot/d7efe02e72>, 0, 0) returned error, retrying after 440.539846ms: trying to cache truncated file <snapshot/d7efe02e72>
Load(<snapshot/d7efe02e72>, 0, 0) returned error, retrying after 753.779102ms: trying to cache truncated file <snapshot/d7efe02e72>
Load(<snapshot/d7efe02e72>, 0, 0) returned error, retrying after 1.366410669s: trying to cache truncated file <snapshot/d7efe02e72>
Load(<snapshot/d7efe02e72>, 0, 0) returned error, retrying after 1.062945682s: trying to cache truncated file <snapshot/d7efe02e72>
Load(<snapshot/d7efe02e72>, 0, 0) returned error, retrying after 2.681870661s: trying to cache truncated file <snapshot/d7efe02e72>
Load(<snapshot/d7efe02e72>, 0, 0) returned error, retrying after 2.17974814s: trying to cache truncated file <snapshot/d7efe02e72>
Load(<snapshot/d7efe02e72>, 0, 0) returned error, retrying after 5.505464165s: trying to cache truncated file <snapshot/d7efe02e72>
Load(<snapshot/d7efe02e72>, 0, 0) returned error, retrying after 8.581298535s: trying to cache truncated file <snapshot/d7efe02e72>
Load(<snapshot/d7efe02e72>, 0, 0) returned error, retrying after 17.012798234s: trying to cache truncated file <snapshot/d7efe02e72>
Load(<snapshot/d7efe02e72>, 0, 0) returned error, retrying after 11.171153083s: trying to cache truncated file <snapshot/d7efe02e72>
Error loading snapshot d7efe02e: load <snapshot/d7efe02e72>: invalid data returned
github.com/restic/restic/internal/restic.FindLatestSnapshot.func1
	src/github.com/restic/restic/internal/restic/snapshot_find.go:39
github.com/restic/restic/internal/repository.(*Repository).List.func1
	src/github.com/restic/restic/internal/repository/repository.go:585
github.com/restic/restic/internal/backend.(*RetryBackend).List.func1.1
	src/github.com/restic/restic/internal/backend/backend_retry.go:133
github.com/restic/restic/internal/backend/sftp.(*SFTP).List
	src/github.com/restic/restic/internal/backend/sftp/sftp.go:462
github.com/restic/restic/internal/limiter.(*rateLimitedBackend).List
	<autogenerated>:1
github.com/restic/restic/internal/backend.(*RetryBackend).List.func1
	src/github.com/restic/restic/internal/backend/backend_retry.go:127
github.com/restic/restic/vendor/github.com/cenkalti/backoff.RetryNotify
	src/github.com/restic/restic/vendor/github.com/cenkalti/backoff/retry.go:37
github.com/restic/restic/internal/backend.(*RetryBackend).retry
	src/github.com/restic/restic/internal/backend/backend_retry.go:36
github.com/restic/restic/internal/backend.(*RetryBackend).List
	src/github.com/restic/restic/internal/backend/backend_retry.go:126
github.com/restic/restic/internal/cache.(*Backend).List
	<autogenerated>:1
github.com/restic/restic/internal/repository.(*Repository).List
	src/github.com/restic/restic/internal/repository/repository.go:579
github.com/restic/restic/internal/restic.FindLatestSnapshot
	src/github.com/restic/restic/internal/restic/snapshot_find.go:36
main.findParentSnapshot
	src/github.com/restic/restic/cmd/restic/cmd_backup.go:317
main.runBackup
	src/github.com/restic/restic/cmd/restic/cmd_backup.go:395
main.glob..func2
	src/github.com/restic/restic/cmd/restic/cmd_backup.go:54
github.com/restic/restic/vendor/github.com/spf13/cobra.(*Command).execute
	src/github.com/restic/restic/vendor/github.com/spf13/cobra/command.go:756
github.com/restic/restic/vendor/github.com/spf13/cobra.(*Command).ExecuteC
	src/github.com/restic/restic/vendor/github.com/spf13/cobra/command.go:846
github.com/restic/restic/vendor/github.com/spf13/cobra.(*Command).Execute
	src/github.com/restic/restic/vendor/github.com/spf13/cobra/command.go:794
main.main
	src/github.com/restic/restic/cmd/restic/main.go:86
runtime.main
	/usr/local/Cellar/go/1.10.3/libexec/src/runtime/proc.go:198
runtime.goexit
	/usr/local/Cellar/go/1.10.3/libexec/src/runtime/asm_amd64.s:2361

Is there a way to fix the repo, so I can continue backing up into it, without having to delete it and restart from scratch?