Restic Dump - "header field too long"

I have a fairly small snapshot that for some reason won’t dump to a tarball. I get

Fatal: cannot dump file: TarHeader: archive/tar: header field too long

The stats are:

Stats in restore-size mode:
     Snapshots processed:  1
        Total File Count:  112021
              Total Size:  10.156 GiB

Stats in raw-data mode:
     Snapshots processed:  1
        Total Blob Count:  81043
 Total Uncompressed Size:  9.322 GiB
              Total Size:  5.273 GiB
    Compression Progress:  100.00%
       Compression Ratio:  1.77x
Compression Space Saving:  43.43%

Version: restic 0.15.1 compiled with go1.19.5 on darwin/amd64
Command: restic dump <snapshot-ID> / > tarball.tar

Any way to get it to dump properly other than dumping subfolders individually?

EDIT: Since it’s a smaller snapshot, it mounted just fine and I was able to tarball/xz it up. Still wondering why dump didn’t work though.

Is there maybe a file with long file name or a large extended attribute? Could you try to narrow it down which file is causing the problem?

Hmm is there a verbosity level / debug mode that would print out the file names as it’s dumping the tarball??

Unfortunately no. But the following patch should be sufficient to log the paths in the DEBUG_LOG for restic 0.15.1:

diff --git a/internal/dump/tar.go b/internal/dump/tar.go
index 6e87aabe5..5c68ccbe6 100644
--- a/internal/dump/tar.go
+++ b/internal/dump/tar.go
@@ -7,6 +7,7 @@ import (
        "path/filepath"
        "strings"
 
+       "github.com/restic/restic/internal/debug"
        "github.com/restic/restic/internal/errors"
        "github.com/restic/restic/internal/restic"
 )
@@ -48,6 +49,7 @@ func tarIdentifier(id uint32) int {
 }
 
 func (d *Dumper) dumpNodeTar(ctx context.Context, node *restic.Node, w *tar.Writer) error {
+       debug.Log("dumping %v", node.Path)
        relPath, err := filepath.Rel("/", node.Path)
        if err != nil {
                return err
1 Like

Ran into this issue again. Now running restic 0.15.2-dev. This time it spit out a path:

Fatal: cannot dump file: writing header for “/Volumes/Macintosh HD/Users/cathy/Library/Containers/com.apple.AboutThisMacLauncher”: archive/tar: header field too long