henrygd/beszel · warning

temperature collection timed out

Error message

temperature collection timed out

What it means

errTemperatureFetchTimeout is a package-level sentinel error representing a timeout of the context used to collect sensor temperatures. updateTemperatures and getTempsWithTimeout return it when the sensors read does not complete before the configured deadline. It also relates to the panic-recovery wrapper for gopsutil sensors quirks (gopsutil#1832).

Source

Thrown at agent/sensors.go:22

	"context"
	"errors"
	"fmt"
	"log/slog"
	"path"
	"runtime"
	"strconv"
	"strings"
	"time"
	"unicode/utf8"

	"github.com/henrygd/beszel/agent/utils"
	"github.com/henrygd/beszel/internal/entities/system"

	"github.com/shirou/gopsutil/v4/common"
	"github.com/shirou/gopsutil/v4/sensors"
)

var errTemperatureFetchTimeout = errors.New("temperature collection timed out")

// Matches sensors.TemperaturesWithContext to allow for panic recovery (gopsutil/issues/1832)
type getTempsFn func(ctx context.Context) ([]sensors.TemperatureStat, error)

type SensorConfig struct {
	context        context.Context
	sensors        map[string]struct{}
	primarySensor  string
	timeout        time.Duration
	isBlacklist    bool
	hasWildcards   bool
	skipCollection bool
	firstRun       bool
}

func (a *Agent) newSensorConfig() *SensorConfig {
	primarySensor, _ := utils.GetEnv("PRIMARY_SENSOR")
	sysSensors, _ := utils.GetEnv("SYS_SENSORS")

View on GitHub (pinned to b38fb7dafa)

Solutions

  1. Increase the sensor collection timeout in SensorConfig if the host is merely slow rather than hung.
  2. Update gopsutil to v4 latest to benefit from the panic-recovery wrapper and sensor fixes.
  3. Verify sensor availability on the host (e.g. run `sensors` or list /sys/class/hwmon); treat absence as expected on VMs/containers.
  4. Ignore/handle the sentinel error gracefully — temperature data is optional and the agent continues without it.
Defensive patterns

Strategy: fallback

Validate before calling

if _, err := os.Stat("/sys/class/hwmon"); os.IsNotExist(err) {
    log.Info("no hwmon sensors on this host; temperature collection will be skipped")
}

Try / catch

temps, err := agent.GetTemps(ctx)
if errors.Is(err, agent.ErrTemperatureFetchTimeout) {
    log.Warn("temperature collection timed out; continuing without sensor data")
    temps = nil
}

Prevention

When it happens

Trigger: Calling updateTemperatures (or getTempsWithTimeout) when sensors.TemperaturesWithContext does not return before the context deadline expires — typically a hanging hwmon/sensors read on the host.

Common situations: Virtual machines or containers without usable sensor hardware; kernels where reading certain hwmon files blocks; overloaded hosts making the sensors syscall slow; gopsutil version with the sensors panic/hang bug (issue 1832).

Understand the failure class

Related errors


AI-assisted analysis of henrygd/beszel@b38fb7dafa (2026-08-31). Data as JSON: /api/errors/48e160fd993574b5. Report an issue: GitHub.