{"record":{"id":"c0affafc29db04f8","repo":"twpayne/chezmoi","slug":"s-unsupported-typeflag-c","errorCode":null,"errorMessage":"%s: unsupported typeflag '%c'","messagePattern":"(.+?): unsupported typeflag '%c'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/chezmoi/archive.go","lineNumber":273,"sourceCode":"\t\t\t\t\tcase errors.Is(err, fs.SkipAll):\n\t\t\t\t\t\treturn nil\n\t\t\t\t\tcase err != nil:\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tswitch err := processHeader(relPath, header); {\n\t\t\tcase errors.Is(err, fs.SkipDir):\n\t\t\t\tcontinue HEADER\n\t\t\tcase errors.Is(err, fs.SkipAll):\n\t\t\t\treturn nil\n\t\t\tcase err != nil:\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase tar.TypeXGlobalHeader:\n\t\t\t// Do nothing.\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"%s: unsupported typeflag '%c'\", header.Name, header.Typeflag)\n\t\t}\n\t}\n}\n\n// walkArchiveZip walks over all the entries in a zip archive.\nfunc walkArchiveZip(r io.ReaderAt, size int64, f WalkArchiveFunc) error {\n\tzipReader, err := zip.NewReader(r, size)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Process a single header, which might be an implicit parent directory.\n\t// Remember already-seen directories so we do not visit them twice.\n\tseenDirErrors := make(map[RelPath]error)\n\tprocessHeader := func(relPath RelPath, fileInfo fs.FileInfo) error {\n\t\tif fileInfo.IsDir() {\n\t\t\tif seenDirError, ok := seenDirErrors[relPath]; ok {\n\t\t\t\treturn seenDirError","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/twpayne/chezmoi/blob/f901167e4685db90da56d6a2a19df642cb3e0247/internal/chezmoi/archive.go#L255-L291","documentation":"walkArchiveTar (internal/chezmoi/archive.go:273) iterates tar headers and handles regular files, directories, symlinks/hardlinks, and GNU/PAX global headers. Any other tar typeflag (e.g. char/block devices, fifos, unknown types) triggers this error naming the entry and typeflag character.","triggerScenarios":"Calling WalkArchive on a tar containing entries with unsupported typeflags such as TypeChar, TypeBlock, TypeFifo, or a typeflag the Go tar package cannot classify.","commonSituations":"Archives created with `tar --format=v7` or containing device nodes/fifos (e.g. dumped from /dev); archives produced by unusual tar implementations with nonstandard entry types.","solutions":["Recreate the archive without special entries: exclude /dev and fifo entries.","Convert special entries: replace devices/fifos with regular files or drop them via tar --exclude.","Prefer a modern tar format: `tar --format=gnu` or `--format=pax` when creating the archive."],"exampleFix":"# before\ntar -cf site.tar /dev/mydevice\n# after\ntar --exclude='/dev/*' --format=pax -cf site.tar myfiles/","handlingStrategy":"validation","validationCode":"// Pre-scan tar for unsupported typeflags\ntr := tar.NewReader(r)\nfor {\n    h, err := tr.Next()\n    if err == io.EOF { break }\n    if err != nil { return err }\n    switch h.Typeflag {\n    case tar.TypeReg, tar.TypeDir, tar.TypeSymlink, tar.TypeLink, tar.TypeXGlobalHeader:\n    default:\n        return fmt.Errorf(\"unsupported entry %s typeflag %c\", h.Name, h.Typeflag)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := walkArchiveTar(r, fn); err != nil {\n    if strings.Contains(err.Error(), \"unsupported typeflag\") {\n        // rebuild archive without special entries\n    }\n    return err\n}","preventionTips":["Create archives with --format=pax or gnu and exclude /dev, fifos, sockets.","List archive contents before importing to spot device/fifo entries.","Prefer regular files, dirs, and symlinks in distributed archives."],"tags":["archive","tar","unsupported-entry"],"backgroundTag":"unsupported-archive-entry","analyzedSha":"f901167e4685db90da56d6a2a19df642cb3e0247","analyzedAt":"2026-09-01T18:16:41.508Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}