{"record":{"id":"8fbcaf1b69be9027","repo":"twpayne/chezmoi","slug":"s-unsupported-mode-o","errorCode":null,"errorMessage":"%s: unsupported mode %o","messagePattern":"(.+?): unsupported mode %o","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/chezmoi/archivereadersystem.go","lineNumber":69,"sourceCode":"\t\tif name.IsEmpty() {\n\t\t\treturn nil\n\t\t}\n\t\tnameAbsPath := options.RootAbsPath.Join(name)\n\n\t\ts.fileInfos[nameAbsPath] = fileInfo\n\t\tswitch {\n\t\tcase fileInfo.IsDir():\n\t\t\t// Do nothing.\n\t\tcase fileInfo.Mode()&fs.ModeType == 0:\n\t\t\tcontents, err := io.ReadAll(r)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"%s: %w\", name, err)\n\t\t\t}\n\t\t\ts.contents[nameAbsPath] = contents\n\t\tcase fileInfo.Mode()&fs.ModeType == fs.ModeSymlink:\n\t\t\ts.linkname[nameAbsPath] = linkname\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"%s: unsupported mode %o\", name, fileInfo.Mode()&fs.ModeType)\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn s, nil\n}\n\n// FileInfos returns s's fs.FileInfos.\nfunc (s *ArchiveReaderSystem) FileInfos() map[AbsPath]fs.FileInfo {\n\treturn s.fileInfos\n}\n\n// Lstat implements System.Lstat.\nfunc (s *ArchiveReaderSystem) Lstat(filename AbsPath) (fs.FileInfo, error) {\n\tfileInfo, ok := s.fileInfos[filename]\n\tif !ok {","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/twpayne/chezmoi/blob/f901167e4685db90da56d6a2a19df642cb3e0247/internal/chezmoi/archivereadersystem.go#L51-L87","documentation":"archiveReaderSystem (internal/chezmoi/archivereadersystem.go:69) errors with \"%s: unsupported mode %o\" when an archive entry is neither a directory, regular file, nor symlink — i.e. its mode type bits match no supported entry kind.","triggerScenarios":"WalkFile over an archive containing entries with mode types like named pipes, devices, or sockets.","commonSituations":"Archives built from /dev or containing fifos/sockets; archives produced by tools that preserve special file types; corruption flipping mode bits.","solutions":["Rebuild the archive excluding special files (exclude /dev, sockets, fifos).","Convert special entries to regular files before archiving.","Use a mainstream archiver and standard formats (tar/pax) so modes are sane."],"exampleFix":"# before\ntar -cf dump.tar /var/run/mypipe /dev/sda\n# after\ntar --exclude='/dev/*' --exclude='*.sock' --exclude='*.pipe' -cf dump.tar myfiles/","handlingStrategy":"validation","validationCode":"// Skip entries with unsupported mode types before processing\nif m := fi.Mode() & fs.ModeType; m != 0 && m != fs.ModeDir && m != fs.ModeSymlink {\n    return fmt.Errorf(\"skipping special entry %s mode %o\", name, m)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Exclude /dev, sockets, and fifos when creating archives.","Use tar/pax formats and mainstream archivers.","Audit archive contents for special file types before import."],"tags":["archive","file-mode","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"}