{"record":{"id":"33f43e3117dd11ef","repo":"twpayne/chezmoi","slug":"s-unsupported-file-mode-o","errorCode":null,"errorMessage":"%s: unsupported file mode %o","messagePattern":"(.+?): unsupported file mode %o","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/chezmoi/archive.go","lineNumber":335,"sourceCode":"\t\tcase 0, fs.ModeDir, fs.ModeSymlink:\n\t\t\t// Create implicit parent directories.\n\t\t\tif dir, _ := relPath.Split(); !dir.IsEmpty() {\n\t\t\t\tdirComponents := dir.TrimTrailingSlash().SplitAll()\n\t\t\t\tfor i := range dirComponents {\n\t\t\t\t\timplicitParentDirRelPath := NewRelPathFromComponents(dirComponents[:i+1]...)\n\t\t\t\t\timplicitParentDirFileInfo := implicitTarDirHeader(implicitParentDirRelPath, fileInfo.ModTime()).FileInfo()\n\t\t\t\t\tswitch err := processHeader(implicitParentDirRelPath, implicitParentDirFileInfo); {\n\t\t\t\t\tcase errors.Is(err, fs.SkipDir):\n\t\t\t\t\t\tcontinue FILE\n\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\tdefault:\n\t\t\treturn fmt.Errorf(\"%s: unsupported file mode %o\", zipFile.Name, fileInfo.Mode())\n\t\t}\n\n\t\tswitch fileInfo.Mode() & fs.ModeType {\n\t\tcase 0:\n\t\t\tzipFileReader, err := zipFile.Open()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = f(relPath, fileInfo, zipFileReader, \"\")\n\t\t\terr2 := zipFileReader.Close()\n\t\t\tswitch {\n\t\t\tcase errors.Is(err, fs.SkipAll):\n\t\t\t\treturn err2\n\t\t\tcase err != nil:\n\t\t\t\treturn err\n\t\t\tcase err2 != nil:\n\t\t\t\treturn err2\n\t\t\t}","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/twpayne/chezmoi/blob/f901167e4685db90da56d6a2a19df642cb3e0247/internal/chezmoi/archive.go#L317-L353","documentation":"walkArchiveZip (internal/chezmoi/archive.go:335) maps zip entry file modes to archive entry types. When a zip entry's mode does not map to a recognized type (regular file, dir, symlink), it returns \"%s: unsupported file mode %o\" with the entry name and mode.","triggerScenarios":"Calling WalkArchive on a zip whose entries carry unusual mode bits (e.g. non-regular modes produced by nonstandard zip creators), or a zip with entries lacking a valid FileInfo mode.","commonSituations":"Zips produced by unusual tools or platforms that set exotic external attributes; zips mixing device-like or irregular mode bits; corrupted zip central directory.","solutions":["Inspect the zip entries (`unzip -l`) and identify the offending entry; recreate the zip with standard tooling.","Re-zip using `zip -r` or a mainstream tool so entries get standard modes.","Convert the archive to tar format, which chezmoi handles more permissively."],"exampleFix":"# before: zip created by unusual tool\nweird-tool --archive=site.zip\n# after\nrm site.zip && zip -r site.zip ./myfiles/","handlingStrategy":"validation","validationCode":"zr, err := zip.OpenReader(path)\nif err != nil { return err }\nfor _, f := range zr.File {\n    if f.Mode()&os.ModeType != 0 && !(f.Mode().IsDir() || f.Mode().IsRegular() || f.Mode()&os.ModeSymlink != 0) {\n        return fmt.Errorf(\"unsupported zip entry mode: %s %o\", f.Name, f.Mode())\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := walkArchiveZip(ra, fn); err != nil {\n    if strings.Contains(err.Error(), \"unsupported file mode\") {\n        // re-zip entries with standard tooling\n    }\n    return err\n}","preventionTips":["Create zips with mainstream tools (zip, Go archive/zip) for standard modes.","Inspect entry modes with `unzip -l` before processing.","Convert exotic zips to tar if special entries are present."],"tags":["archive","zip","file-mode"],"backgroundTag":"unsupported-archive-entry","analyzedSha":"f901167e4685db90da56d6a2a19df642cb3e0247","analyzedAt":"2026-09-01T18:16:41.508Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}