slimtoolkit/slim · error
run sensor without monitor failed: %w
Error message
run sensor without monitor failed: %w
What it means
The controlled sensor's run loop starts the sensor without a monitor; when StartMonitorFailed is published (monitor setup failed) the underlying error is wrapped with this message and returned to the state machine caller. It is a wrapper: the real cause is in the %w-wrapped error and the StartMonitorFailedData event.
Source
Thrown at pkg/app/sensor/controlled/controlled.go:97
return err
}
func (s *Sensor) run() error {
log.Info("sensor: waiting for commands...")
for {
mon, err := s.runWithoutMonitor()
if err != nil {
s.exe.HookMonitorFailed()
s.exe.PubEvent(event.StartMonitorFailed,
&event.StartMonitorFailedData{
Component: event.ComMonitorRunner, //TODO: need to get to the real component
State: s.exe.State(),
Errors: []string{err.Error()},
})
return fmt.Errorf("run sensor without monitor failed: %w", err)
}
if mon == nil {
return nil
}
s.exe.PubEvent(event.StartMonitorDone)
if err := s.runWithMonitor(mon); err != nil {
return fmt.Errorf("run sensor with monitor failed: %w", err)
}
s.exe.HookMonitorPostShutdown()
s.exe.PubEvent(event.StopMonitorDone)
}
}
func (s *Sensor) runWithoutMonitor() (monitor.CompositeMonitor, error) {View on GitHub (pinned to 81940d17fa)
Solutions
- Read the wrapped error and the StartMonitorFailedData.Errors for the root cause
- Verify monitor prerequisites (artifacts env, permissions, kernel support) before starting
- Fix the underlying monitor startup error surfaced in the event
Defensive patterns
Strategy: try-catch
Validate before calling
// verify monitor prerequisites before run:
// writable artifacts dir exists and mount point is accessible
if _, err := os.Stat(artifactsDir); err != nil { return err } Try / catch
err := sensor.Run(ctx)
if err != nil {
root := err
for errors.Unwrap(root) != nil { root = errors.Unwrap(root) }
log.Printf("sensor run failed: %v (root: %v)", err, root)
} Prevention
- Subscribe to StartMonitorFailed events to capture root-cause errors array
- Pre-validate artifacts env and permissions before Run
- Use errors.Is/As on the wrapped chain
When it happens
Trigger: run() is invoked and monitor startup fails, causing the StartMonitorFailed event and a non-nil err, so runWithoutMonitor aborts.
Common situations: Bad monitor configuration, missing artifacts env, driver/loader failures when the monitor component cannot initialize.
Related errors
- run sensor with monitor failed: %w
- failed to prepare artifacts env: %w
- composite monitor failed: %w
- sensor shutdown before monitor stop
- ambiguous start command: cannot use [app_name,app_args] and
AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31).
Data as JSON: /api/errors/b4b8c4f77c55a1ee.
Report an issue: GitHub.