slimtoolkit/slim · error
findSymlinks - could not convert fileInfo to Stat_t for %s
Error message
findSymlinks - could not convert fileInfo to Stat_t for %s
What it means
findSymlinks walks the filesystem collecting symlinks and filters entries by the device they live on. It asserts that each dirent's Sys() value is a *syscall.Stat_t; on Linux this always succeeds, but on other platforms Sys() returns a different type. When the assertion fails the walk aborts with this error, stopping symlink discovery entirely.
Source
Thrown at pkg/app/sensor/artifact/artifact.go:3446
}
return nil
}
}
if err != nil {
log.Debugf("findSymlinks: error accessing %q: %v\n", fullName, err)
//just ignore the error and keep going
return nil
}
if fileInfo.Sys() == nil {
log.Debugf("findSymlinks: fileInfo.Sys() is nil (ignoring)")
return nil
}
sysStatInfo, ok := fileInfo.Sys().(*syscall.Stat_t)
if !ok {
return fmt.Errorf("findSymlinks - could not convert fileInfo to Stat_t for %s", fullName)
}
if _, ok := devices[uint64(sysStatInfo.Dev)]; !ok {
log.Debugf("findSymlinks: ignoring %v (by device id - %v)", fullName, sysStatInfo.Dev)
//NOTE:
//don't return filepath.SkipDir for everything
//because we might still need other files in the dir
//return filepath.SkipDir
//example: "/etc/hostname" Docker mounts from another device
//NOTE:
//can move the checks for /dev, /sys and /proc here too
return nil
}
if fileInfo.Mode()&os.ModeSymlink != 0 {
checkPathSymlinks(fullName)
if info, err := getFileSysStats(fullName); err == nil {View on GitHub (pinned to 81940d17fa)
Solutions
- Build/run the sensor only on Linux targets where Sys() is guaranteed to be *syscall.Stat_t
- Mirror the nil-Sys() handling above: log and skip entries whose Sys() cannot be converted instead of failing the whole walk
- Use a portable stat conversion (e.g. fileInfo.Sys() with platform-specific assertions per GOOS)
Example fix
// before
sysStatInfo, ok := fileInfo.Sys().(*syscall.Stat_t)
if !ok {
return fmt.Errorf("findSymlinks - could not convert fileInfo to Stat_t for %s", fullName)
}
// after
sysStatInfo, ok := fileInfo.Sys().(*syscall.Stat_t)
if !ok {
log.Debugf("findSymlinks: cannot convert to Stat_t (ignoring): %s", fullName)
return nil
} Defensive patterns
Strategy: type-guard
Validate before calling
if fi, err := os.Lstat(path); err == nil {
if _, ok := fi.Sys().(*syscall.Stat_t); !ok {
log.Printf("non-Stat_t filesystem: %s", path)
}
} Type guard
func asStatT(fi os.FileInfo) (*syscall.Stat_t, bool) {
s, ok := fi.Sys().(*syscall.Stat_t)
return s, ok
} Try / catch
if err := walkErr; err != nil {
var convErr *fmt.Errorf
if strings.Contains(err.Error(), "could not convert fileInfo to Stat_t") {
// degrade gracefully: skip symlink device filtering
} else {
return err
}
} Prevention
- Target Linux-only builds for this code path (build tags //go:build linux)
- Treat Stat_t conversion failure as skip-and-log, not fatal
- Add unit tests with fake FileInfo implementations to assert skip behavior
When it happens
Trigger: Running the artifact scanner on a non-Linux platform (or a filesystem layer whose os.FileInfo.Sys() is not *syscall.Stat_t) while findSymlinks processes a directory entry.
Common situations: Cross-compiling or porting the sensor to darwin/Windows where FileInfo.Sys() carries a different stat type; FUSE or exotic filesystems returning nil/alternative Sys() payloads.
Related errors
- failed to get system stat info for %s
- failed to enumerate current paths: %w
- sensor received unepxected command: %#+v
- failed to prepare artifacts env: %w
- failed to enumerate current paths: %w
AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31).
Data as JSON: /api/errors/054c6cdf0d254049.
Report an issue: GitHub.