slimtoolkit/slim · error
not implemented archiving file type
Error message
not implemented archiving file type %s (%s)
What it means
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.
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.
Example fix
// before
err := os.Symlink("/usr/bin/real", "/build/rootfs/bin/link") // causes failure
// after
src, _ := os.ReadFile("/usr/bin/real")
os.WriteFile("/build/rootfs/bin/link", src, 0o755) // regular file instead of symlink Defensive patterns
Strategy: validation
Validate before calling
var unsupported []string
filepath.Walk(src, func(p string, info os.FileInfo, err error) error {
if err == nil && !info.Mode().IsDir() && !info.Mode().IsRegular() {
unsupported = append(unsupported, p)
}
return nil
})
if len(unsupported) > 0 {
return fmt.Errorf("unsupported entries in layer: %v", unsupported)
} Type guard
func isTarSupported(info os.FileInfo) bool {
return info.Mode().IsDir() || info.Mode().IsRegular()
} Try / catch
if err != nil && strings.Contains(err.Error(), "not implemented archiving file type") {
// clean symlinks/sockets/devices from the layer dir and rebuild
} Prevention
- 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
When it happens
Trigger: The layer directory contains a symlink, named pipe, socket, or device file; filepath.Walk reaches it and the mode checks IsDir/IsRegular both fail.
Common situations: 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.
Related errors
- failed to calculate relative path
- failed to read file into the tar
- failed to scan files
- bad output tar
- cannot write file
AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31).
Data as JSON: /api/errors/8db23b3e083ed20e.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/imagebuilder/internalbuilder/engine.go:304
if err != nil {
return fmt.Errorf("failed to calculate relative path: %w", err)
}
hdr := &tar.Header{
Name: path.Join(layerBasePath, filepath.ToSlash(rel)),
Mode: int64(info.Mode()),
}
if !info.IsDir() {
hdr.Size = info.Size()
}
if info.Mode().IsDir() {
hdr.Typeflag = tar.TypeDir
} else if info.Mode().IsRegular() {
hdr.Typeflag = tar.TypeReg
} else {
return fmt.Errorf("not implemented archiving file type %s (%s)", info.Mode(), rel)
}
if err := tw.WriteHeader(hdr); err != nil {
return fmt.Errorf("failed to write tar header: %w", err)
}
if !info.IsDir() {
f, err := os.Open(fp)
if err != nil {
return err
}
if _, err := io.Copy(tw, f); err != nil {
return fmt.Errorf("failed to read file into the tar: %w", err)
}
f.Close()
}
return nil
})
View on GitHub (pinned to 81940d17fa)