{"record":{"id":"8db23b3e083ed20e","repo":"slimtoolkit/slim","slug":"not-implemented-archiving-file-type-s-s","errorCode":null,"errorMessage":"not implemented archiving file type %s (%s)","messagePattern":"not implemented archiving file type (.+?) \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/imagebuilder/internalbuilder/engine.go","lineNumber":304,"sourceCode":"\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to calculate relative path: %w\", err)\n\t\t}\n\n\t\thdr := &tar.Header{\n\t\t\tName: path.Join(layerBasePath, filepath.ToSlash(rel)),\n\t\t\tMode: int64(info.Mode()),\n\t\t}\n\n\t\tif !info.IsDir() {\n\t\t\thdr.Size = info.Size()\n\t\t}\n\n\t\tif info.Mode().IsDir() {\n\t\t\thdr.Typeflag = tar.TypeDir\n\t\t} else if info.Mode().IsRegular() {\n\t\t\thdr.Typeflag = tar.TypeReg\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"not implemented archiving file type %s (%s)\", info.Mode(), rel)\n\t\t}\n\n\t\tif err := tw.WriteHeader(hdr); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to write tar header: %w\", err)\n\t\t}\n\t\tif !info.IsDir() {\n\t\t\tf, err := os.Open(fp)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif _, err := io.Copy(tw, f); err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to read file into the tar: %w\", err)\n\t\t\t}\n\t\t\tf.Close()\n\t\t}\n\t\treturn nil\n\t})\n","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/imagebuilder/internalbuilder/engine.go#L286-L322","documentation":"When tar-ing the layer directory, only regular files and directories are supported; symlinks, devices, sockets, FIFOs etc. hit this error because no tar Typeflag is set for them. The message includes the file mode and relative path so the offending entry can be located.","triggerScenarios":"The layer directory contains a symlink, named pipe, socket, or device file; filepath.Walk reaches it and the mode checks IsDir/IsRegular both fail.","commonSituations":"Building an image from a rootfs that includes /dev entries or symlinks (common when snapshotting a real filesystem), build tooling leaving socket files in the layer dir, or a symlinked output artifact.","solutions":["Remove or replace unsupported file types (symlinks, sockets, devices) from the layer directory before building.","Pre-process the rootfs: dereference or copy symlinks as regular files.","Skip or explicitly exclude paths like /dev, /proc, /sys when assembling the layer directory."],"exampleFix":"// before\nerr := os.Symlink(\"/usr/bin/real\", \"/build/rootfs/bin/link\") // causes failure\n// after\nsrc, _ := os.ReadFile(\"/usr/bin/real\")\nos.WriteFile(\"/build/rootfs/bin/link\", src, 0o755) // regular file instead of symlink","handlingStrategy":"validation","validationCode":"var unsupported []string\nfilepath.Walk(src, func(p string, info os.FileInfo, err error) error {\n    if err == nil && !info.Mode().IsDir() && !info.Mode().IsRegular() {\n        unsupported = append(unsupported, p)\n    }\n    return nil\n})\nif len(unsupported) > 0 {\n    return fmt.Errorf(\"unsupported entries in layer: %v\", unsupported)\n}","typeGuard":"func isTarSupported(info os.FileInfo) bool {\n    return info.Mode().IsDir() || info.Mode().IsRegular()\n}","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"not implemented archiving file type\") {\n    // clean symlinks/sockets/devices from the layer dir and rebuild\n}","preventionTips":["Exclude /dev, /proc, /sys when assembling rootfs layers","Replace symlinks with real copies before building","Scan the layer dir for non-regular entries as a pre-build check"],"tags":["tar","filesystem","unsupported-file-type","image-build"],"backgroundTag":"unsupported-file-type-in-tar","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}