{"record":{"id":"26f8f70b8cc2afb8","repo":"slimtoolkit/slim","slug":"saving-reports-failed-w-26f8f7","errorCode":null,"errorMessage":"saving reports failed: %w","messagePattern":"saving reports failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/app/sensor/standalone/standalone.go","lineNumber":197,"sourceCode":"\n\treport, err := mon.Status()\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"sensor: target app failed\")\n\t\treturn err\n\t}\n\tlog.Info(\"sensor: target app is done\")\n\ts.exe.HookMonitorPostShutdown()\n\ts.exe.PubEvent(event.StopMonitorDone)\n\n\tif err := s.artifactor.Process(\n\t\tcmd,\n\t\ts.mountPoint,\n\t\treport.PeReport,\n\t\treport.FanReport,\n\t\treport.PtReport,\n\t); err != nil {\n\t\tlog.WithError(err).Error(\"sensor: artifact.Process() failed\")\n\t\treturn fmt.Errorf(\"saving reports failed: %w\", err)\n\t}\n\n\treturn nil\n}\n\nfunc (s *Sensor) runMonitor(mon monitor.CompositeMonitor) {\n\tticker := time.NewTicker(time.Second * 5)\n\tdefer ticker.Stop()\n\nloop:\n\tfor {\n\t\tselect {\n\t\tcase <-mon.Done():\n\t\t\tbreak loop\n\n\t\tcase cmd := <-s.exe.Commands():\n\t\t\tlog.Infof(\"sensor: recieved control command => %s\", cmd.GetName())\n\t\t\tif cmd.GetName() == command.StopMonitorName {","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/app/sensor/standalone/standalone.go#L179-L215","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the wrapped error and the 'sensor: artifact.Process() failed' log line for the exact write failure.","Verify the mount point is writable (not mounted read-only) and has free space.","Ensure the artifacts output directory exists or is created by PrepareEnv before processing.","Check the reports for nil/corrupt content; if monitoring failed earlier, fix the upstream monitor error first."],"exampleFix":"// before\ndocker run --rm -v /artifacts:/artifacts:ro sensor-image\n// after\ndocker run --rm -v /artifacts:/artifacts:rw sensor-image","handlingStrategy":"validation","validationCode":"if err := unix.Access(mountPoint, unix.W_OK); err != nil {\n    return fmt.Errorf(\"report output %s not writable: %w\", mountPoint, err)\n}\nusage := getDiskUsage(mountPoint)\nif usage.FreeBytes < 100*1024*1024 {\n    return fmt.Errorf(\"insufficient space on %s\", mountPoint)\n}","typeGuard":null,"tryCatchPattern":"if err := sensor.Run(ctx); err != nil {\n    if strings.Contains(err.Error(), \"saving reports failed\") {\n        log.Errorf(\"report persistence failed; check mount rw and disk space: %v\", err)\n    }\n    return err\n}","preventionTips":["Never mount the report output volume read-only.","Ensure PrepareEnv ran successfully before monitoring so output dirs exist.","Alert on low disk space for the artifacts volume.","Validate reports are non-nil after a monitor run before calling artifact.Process."],"tags":["go","sensor","report-persistence","filesystem"],"backgroundTag":"report-write-failed","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}