slimtoolkit/slim · error

failed to enumerate current paths: %w

Error message

failed to enumerate current paths: %w

What it means

Wraps an error from s.artifactor.GetCurrentPaths(s.mountPoint, cmd.Excludes), which enumerates the current filesystem paths under the mount point while applying the command's excludes. The library throws it when enumeration fails, typically because the mount point is missing/unreadable or a traversal error occurs.

Source

Thrown at pkg/app/sensor/standalone/standalone.go:136

		return fmt.Errorf("unexpected start monitor command: %+v", cmd)
	}

	if err := s.artifactor.PrepareEnv(cmd); err != nil {
		log.WithError(err).Error("sensor: artifactor.PrepareEnv() failed")
		s.exe.HookMonitorFailed()
		s.exe.PubEvent(event.StartMonitorFailed,
			&event.StartMonitorFailedData{
				Component: event.ComSensorCmdServer,
				State:     event.StateEnvPreparing,
				Errors:    []string{err.Error()},
			})
		return fmt.Errorf("failed to prepare artifacts env: %w", err)
	}

	origPaths, err := s.artifactor.GetCurrentPaths(s.mountPoint, cmd.Excludes)
	if err != nil {
		log.WithError(err).Error("sensor: artifactor.GetCurrentPaths() failed")
		return fmt.Errorf("failed to enumerate current paths: %w", err)
	}

	s.exe.HookMonitorPreStart()

	mon, err := s.newMonitor(
		s.ctx,
		cmd,
		s.workDir,
		s.del,
		s.artifactor.ArtifactsDir(),
		s.mountPoint,
		origPaths,
	)
	if err != nil {
		log.WithError(err).Error("sensor: failed to create composite monitor")
		s.exe.HookMonitorFailed()
		s.exe.PubEvent(event.StartMonitorFailed,
			&event.StartMonitorFailedData{

View on GitHub (pinned to 81940d17fa)

Solutions

  1. Check the wrapped error and log line 'sensor: artifactor.GetCurrentPaths() failed' for the exact traversal failure.
  2. Verify s.mountPoint exists and is a mounted, readable directory (mount | grep <path>).
  3. Ensure the sensor process has read permissions across the monitored tree.
  4. Review cmd.Excludes for invalid or conflicting patterns and correct them.

Example fix

// before (mount point never mounted)
mountPoint := "/hostfs" // directory exists but is empty
// after
// ensure host root is mounted before starting the sensor
docker run --rm -v /:/hostfs:ro sensor-image // mountPoint = /hostfs
Defensive patterns

Strategy: validation

Validate before calling

info, err := os.Stat(mountPoint)
if err != nil || !info.IsDir() {
    return fmt.Errorf("mount point %s missing or not a directory", mountPoint)
}
if f, err := os.Open(mountPoint); err != nil {
    return fmt.Errorf("mount point %s not readable: %w", mountPoint, err)
} else {
    f.Close()
}

Try / catch

if err := sensor.Run(ctx); err != nil {
    if strings.Contains(err.Error(), "failed to enumerate current paths") {
        log.Errorf("mount point unreadable; verify volume mounts: %v", err)
    }
    return err
}

Prevention

When it happens

Trigger: StartMonitor flow reaching artifactor.GetCurrentPaths when s.mountPoint does not exist, is not a directory, or the process lacks read permission on it or on paths under it.

Common situations: Mount point path typo'd or not actually mounted in the container; running the sensor without the required volume mounted; permission-restricted directories under the mount point; excludes referencing paths that break the walker.

Related errors


AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31). Data as JSON: /api/errors/877b930e33ee1619. Report an issue: GitHub.