slimtoolkit/slim · error
run sensor with monitor failed: %w
Error message
run sensor with monitor failed: %w
What it means
run() starts the composite monitor and then delegates to runWithMonitor, which runs until the monitor finishes. If runWithMonitor returns an error, run wraps it with this message. The wrapped error originates deeper (monitor failure, unexpected command, reporting).
Source
Thrown at pkg/app/sensor/controlled/controlled.go:107
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) {
ticker := time.NewTicker(5 * time.Second)
defer ticker.Stop()
for {
select {
case cmd := <-s.exe.Commands():
log.Debugf("sensor: new command => %+v", cmd)
switch typedCmd := cmd.(type) {
case *command.StartMonitor:View on GitHub (pinned to 81940d17fa)
Solutions
- Unwrap with errors.Unwrap / %w chain to find the root cause
- Check monitor logs and its Status() report for the failure
- Re-run with debug logging around monitor lifecycle events
Defensive patterns
Strategy: try-catch
Try / catch
err := sensor.Run(ctx)
var wrapped interface{ Unwrap() error }
if errors.As(err, &wrapped) {
log.Printf("monitor run root cause: %v", errors.Unwrap(err))
} Prevention
- Enable debug logging across the monitor lifecycle
- Check that control commands are sent in correct order
- Inspect monitor Status/report artifacts after failure
When it happens
Trigger: s.runWithMonitor(mon) returns any error during a monitored sensor run — e.g. monitor error, unexpected stop command, or result-processing failure.
Common situations: Monitor crashing mid-capture, control commands arriving out of order, downstream artifact processing failures.
Related errors
- run sensor without 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/6bb4ad5af8769454.
Report an issue: GitHub.