diff --git a/beszel/internal/agent/sensors.go b/beszel/internal/agent/sensors.go index ca7370c..f727bde 100644 --- a/beszel/internal/agent/sensors.go +++ b/beszel/internal/agent/sensors.go @@ -6,8 +6,10 @@ import ( "fmt" "log/slog" "path" + "runtime" "strconv" "strings" + "unicode/utf8" "github.com/shirou/gopsutil/v4/common" "github.com/shirou/gopsutil/v4/sensors" @@ -103,6 +105,11 @@ func (a *Agent) updateTemperatures(systemStats *system.Stats) { systemStats.Temperatures = make(map[string]float64, len(temps)) for i, sensor := range temps { + // check for malformed strings on darwin (gopsutil/issues/1832) + if runtime.GOOS == "darwin" && !utf8.ValidString(sensor.SensorKey) { + continue + } + // scale temperature if sensor.Temperature != 0 && sensor.Temperature < 1 { sensor.Temperature = scaleTemperature(sensor.Temperature)