Skip to content

prune: Handle tree not found correctly #1759

@fd0

Description

@fd0

Bug reported by a user in the forum:
https://forum.restic.net/t/snapshots-seem-to-be-created-but-i-always-get-a-strange-error/637

Output of restic version

0.8.3

How did you run restic exactly?

42 * * * * source /Users/gio/.restic/restic-env; /usr/local/bin/restic backup -q --exclude-file /Users/gio/.restic/exclude.txt /Users/gio; /usr/local/bin/restic forget -q --prune --keep-hourly 48 --keep-daily 30 --keep-monthly 12

What backend/server/service did you use to store the repository?

GCS

Expected behavior

Handle the error, complain about it, but complete the process.

Actual behavior

tree 5cb11d839b361e406f30867802f34a7a26b99470b599da5ef36cd209cd4fdb86 not found in repository
github.com/restic/restic/internal/repository.(*Repository).LoadTree
        /tmp/restic-build-881482904/src/github.com/restic/restic/internal/repository/repository.go:620
github.com/restic/restic/internal/restic.FindUsedBlobs
        /tmp/restic-build-881482904/src/github.com/restic/restic/internal/restic/find.go:11
github.com/restic/restic/internal/restic.FindUsedBlobs
        /tmp/restic-build-881482904/src/github.com/restic/restic/internal/restic/find.go:31
github.com/restic/restic/internal/restic.FindUsedBlobs
        /tmp/restic-build-881482904/src/github.com/restic/restic/internal/restic/find.go:31
github.com/restic/restic/internal/restic.FindUsedBlobs
        /tmp/restic-build-881482904/src/github.com/restic/restic/internal/restic/find.go:31
github.com/restic/restic/internal/restic.FindUsedBlobs
        /tmp/restic-build-881482904/src/github.com/restic/restic/internal/restic/find.go:31
github.com/restic/restic/internal/restic.FindUsedBlobs
        /tmp/restic-build-881482904/src/github.com/restic/restic/internal/restic/find.go:31
github.com/restic/restic/internal/restic.FindUsedBlobs
        /tmp/restic-build-881482904/src/github.com/restic/restic/internal/restic/find.go:31
github.com/restic/restic/internal/restic.FindUsedBlobs
        /tmp/restic-build-881482904/src/github.com/restic/restic/internal/restic/find.go:31
github.com/restic/restic/internal/restic.FindUsedBlobs
        /tmp/restic-build-881482904/src/github.com/restic/restic/internal/restic/find.go:31
github.com/restic/restic/internal/restic.FindUsedBlobs
        /tmp/restic-build-881482904/src/github.com/restic/restic/internal/restic/find.go:31
main.pruneRepository
        src/github.com/restic/restic/cmd/restic/cmd_prune.go:191
main.runForget
        src/github.com/restic/restic/cmd/restic/cmd_forget.go:235
main.glob..func9
        src/github.com/restic/restic/cmd/restic/cmd_forget.go:24
github.com/restic/restic/vendor/github.com/spf13/cobra.(*Command).execute
        /tmp/restic-build-881482904/src/github.com/restic/restic/vendor/github.com/spf13/cobra/command.go:698
github.com/restic/restic/vendor/github.com/spf13/cobra.(*Command).ExecuteC
        /tmp/restic-build-881482904/src/github.com/restic/restic/vendor/github.com/spf13/cobra/command.go:783
github.com/restic/restic/vendor/github.com/spf13/cobra.(*Command).Execute
        /tmp/restic-build-881482904/src/github.com/restic/restic/vendor/github.com/spf13/cobra/command.go:736
main.main
        src/github.com/restic/restic/cmd/restic/main.go:69
runtime.main
        /usr/local/Cellar/go/1.10/libexec/src/runtime/proc.go:198
runtime.goexit
        /usr/local/Cellar/go/1.10/libexec/src/runtime/asm_amd64.s:2361

Steps to reproduce the behavior

I'm guessing here:

  • Initialize a repo
  • Backup some data
  • Delete a pack file which contains metadata (trees)
  • Run restic prune

Do you have any idea what may have caused this?

Error is not correctly handled.

Do you have an idea how to solve the issue?

Handle the error, try to salvage as much data as possible.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions