Invalid repo: id 00...00 not found in repository

Hi there,

Context

I have played a bit w/ restic, and now I’m trying to write some scripts (node js) for automatic backup. The node.js script launches the restic command.
During this process, I hit quite often CTRL + C. I think that the restic command catches CTRL + C and does a graceful shutdown. I’m not sure if this also happens when I CTRL + C on the parent node.js script.

Pre problem

Initially I had an error which was complaining about a bad snapshot. I saw that it existed as file in the repo, but had length = 0. So w/o doubt the result of the above flow. But I deleted it and things started to work.

Problem

Now, the restic check command says:

...
check all packs
pack 5e37e6f6: not referenced in any index
1 additional files were found in the repo, which likely contain duplicate data.
You can run `restic prune` to correct this.
check snapshots, trees and blobs
error for tree [null]:
  id 0000000000000000000000000000000000000000000000000000000000000000 not found in repository
Fatal: repository contains errors

I ran restic prune which fails with an exception:

building new index for repo
[0:00] 100.00%  4797 / 4797 packs
incomplete pack file (will be removed): 5e37e6f67f2f8d048952ce3f6e84b8dd3ffdb2bac275eb06986d5c6ef33f5585
repository contains 4796 packs (571662 blobs) with 22.190 GiB
processed 571662 blobs: 63 duplicate blobs, 16.186 MiB duplicate
load all snapshots
find data that is still in use for 13 snapshots
[0:32] 92.31%  12 / 13 snapshots
id 0000000000000000000000000000000000000000000000000000000000000000 not found in repository
github.com/restic/restic/internal/repository.(*Repository).LoadBlob
        /restic/internal/repository/repository.go:156
github.com/restic/restic/internal/repository.(*Repository).LoadTree
        /restic/internal/repository/repository.go:723
github.com/restic/restic/internal/restic.FindUsedBlobs
        /restic/internal/restic/find.go:19
main.getUsedBlobs
        /restic/cmd/restic/cmd_prune.go:276
main.pruneRepository
        /restic/cmd/restic/cmd_prune.go:158
main.runPrune
        /restic/cmd/restic/cmd_prune.go:62
main.glob..func18
github.com/spf13/cobra.(*Command).execute
        /home/build/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:826
github.com/spf13/cobra.(*Command).ExecuteC
        /home/build/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914
github.com/spf13/cobra.(*Command).Execute
        /home/build/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
main.main
        /restic/cmd/restic/main.go:98
runtime.main
        /usr/local/go/src/runtime/proc.go:204
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1374

Thanks in advance for any hints!
Regards,
Cristian

1 Like

Interesting, we’ve recently received a very similar report here:

Can you try the same steps described there?

We’re tracking this as the following issue:

1 Like

It seems like there’s a bug in restic which makes it create an empty snapshot (so the referenced tree structure is null). Can you please find out which snapshot that is by running the following command:

restic list snapshots -q | while read idxid; do \
        restic cat -q snapshot $idxid | jq "select(.tree | contains (\"0000000000000000000000000000000000000000000000000000000000000000\")) | .id = \"$idxid\""; \
done

I’d love to know the exact version of restic you used to create that snapshot!

Afterwards, you can remove the snpashot(s) with restic forget <id> <id2> ... and then your repo is fine again.

1 Like

Thanks Alexander!

My version:

restic 0.11.0 compiled with go1.15.3 on windows/amd64

Thanks for the command! Actually I am on Windows. I ran it by hand on a few snapshots and spotted the corrupted snapshot right away. Otherwise I would have connected from a Linux VM.

BTW: I wanted to begin my post with this, but I forgot:

What a nice piece of software is Restic. In my opinion the description is very appropriate: “… done right”!

2 Likes

Ok, no problem! So you found the snapshot which references the all-zeroes tree, removed it, and now you’re fine? :slight_smile:

1 Like

Yes indeed. I continue my experiments.

2 Likes