slimtoolkit/slim · error

saving reports failed: %w

Error message

saving reports failed: %w

What it means

Wraps an error from artifact.Process(...) which persists the collected reports (PeReport, FanReport, PtReport) to the given mount point. The library throws it after logging 'sensor: artifact.Process() failed' when writing/saving the monitoring reports fails.

Source

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

	report, err := mon.Status()
	if err != nil {
		log.WithError(err).Error("sensor: target app failed")
		return err
	}
	log.Info("sensor: target app is done")
	s.exe.HookMonitorPostShutdown()
	s.exe.PubEvent(event.StopMonitorDone)

	if err := s.artifactor.Process(
		cmd,
		s.mountPoint,
		report.PeReport,
		report.FanReport,
		report.PtReport,
	); err != nil {
		log.WithError(err).Error("sensor: artifact.Process() failed")
		return fmt.Errorf("saving reports failed: %w", err)
	}

	return nil
}

func (s *Sensor) runMonitor(mon monitor.CompositeMonitor) {
	ticker := time.NewTicker(time.Second * 5)
	defer ticker.Stop()

loop:
	for {
		select {
		case <-mon.Done():
			break loop

		case cmd := <-s.exe.Commands():
			log.Infof("sensor: recieved control command => %s", cmd.GetName())
			if cmd.GetName() == command.StopMonitorName {

View on GitHub (pinned to 81940d17fa)

Solutions

  1. Check the wrapped error and the 'sensor: artifact.Process() failed' log line for the exact write failure.
  2. Verify the mount point is writable (not mounted read-only) and has free space.
  3. Ensure the artifacts output directory exists or is created by PrepareEnv before processing.
  4. Check the reports for nil/corrupt content; if monitoring failed earlier, fix the upstream monitor error first.

Example fix

// before
docker run --rm -v /artifacts:/artifacts:ro sensor-image
// after
docker run --rm -v /artifacts:/artifacts:rw sensor-image
Defensive patterns

Strategy: validation

Validate before calling

if err := unix.Access(mountPoint, unix.W_OK); err != nil {
    return fmt.Errorf("report output %s not writable: %w", mountPoint, err)
}
usage := getDiskUsage(mountPoint)
if usage.FreeBytes < 100*1024*1024 {
    return fmt.Errorf("insufficient space on %s", mountPoint)
}

Try / catch

if err := sensor.Run(ctx); err != nil {
    if strings.Contains(err.Error(), "saving reports failed") {
        log.Errorf("report persistence failed; check mount rw and disk space: %v", err)
    }
    return err
}

Prevention

When it happens

Trigger: End of the standalone sensor's monitor run when artifact.Process is called with the mount point and reports, and saving fails: unwritable output location, missing directory, disk full, or serialization failure of a report.

Common situations: Read-only mount point (e.g. mounted :ro); artifacts volume not mounted in the container; disk quota/full; corrupt or nil report produced by a failed monitoring session.

Related errors


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