nicolargo/glances · error · ValueError

Unsupported sensor: {self.sensor_type}

Error message

Unsupported sensor: {self.sensor_type}

What it means

ValueError raised by the sensors subsystem's data fetch when self.sensor_type does not match any known sensor definition (temperature via psutil.sensors_temperatures or fan speed via psutil.sensors_fans). It signals an internal misconfiguration of the sensor type string, since only those two psutil backends exist.

Source

Thrown at glances/plugins/sensors/__init__.py:353

            self.__fetch_data()
            self.init = True
        except AttributeError:
            logger.debug(f"Cannot grab {self.sensor_type}. Platform not supported.")

    def __fetch_data(self) -> dict[str, list]:
        if self.sensor_type == sensors_definition.get('cpu_temp').get('type'):
            # Solve an issue #1203 concerning a RunTimeError warning message displayed
            # in the curses interface.
            warnings.filterwarnings("ignore")

            # psutil>=5.1.0, Linux-only
            return psutil.sensors_temperatures()

        if self.sensor_type == sensors_definition.get('fan_speed').get('type'):
            # psutil>=5.2.0, Linux-only
            return psutil.sensors_fans()

        raise ValueError(f"Unsupported sensor: {self.sensor_type}")

    def update(self) -> list[dict]:
        """Update the stats."""
        if not self.init:
            return []

        # Temperatures sensors
        ret = []
        data = self.__fetch_data()
        for chip_name, chip in data.items():
            label_index = 1
            for chip_name_index, feature in enumerate(chip):
                sensors_current = {}
                # Sensor name
                if feature.label == '':
                    sensors_current['label'] = chip_name + ' ' + str(chip_name_index)
                elif feature.label in [i['label'] for i in ret]:
                    sensors_current['label'] = feature.label + ' ' + str(label_index)

View on GitHub (pinned to a240d8dfb3)

Solutions

  1. Pass the exact value of sensors_definition['temperature'/'fan_speed']['type'] as sensor_type
  2. If adding a new sensor kind, add a matching branch or map it to an existing psutil backend in __fetch_data
  3. Update to matching upstream versions so definitions and fetch logic stay in sync

Example fix

# before
s = GlancesSensors(sensor_type='temp')
# after
from glances.plugins.sensors.sensors_definition import sensors_definition
s = GlancesSensors(sensor_type=sensors_definition['temperature']['type'])
Defensive patterns

Strategy: validation

Validate before calling

from glances.plugins.sensors.sensors_definition import sensors_definition
valid_types = {d['type'] for d in sensors_definition.values()}
assert sensor_type in valid_types

Type guard

def supported_sensor(t: str) -> bool:
    from glances.plugins.sensors.sensors_definition import sensors_definition
    return t in {d['type'] for d in sensors_definition.values()}

Try / catch

try:
    data = fetcher.__fetch_data()
except ValueError as e:
    if 'Unsupported sensor' in str(e):
        data = None
    else:
        raise

Prevention

When it happens

Trigger: __init__ or update() of the sensors plugin running with a sensor_type not equal to the 'temperature' or 'fan_speed' definitions from sensors_definition — e.g. a custom/renamed definition dict or a code path passing the raw config name instead of the definition's type field.

Common situations: Forks adding new sensor kinds (e.g. battery/current) without extending __fetch_data; upstream renames of the definitions dict keys; typo'd sensor type strings in custom configs.

Related errors


AI-assisted analysis of nicolargo/glances@a240d8dfb3 (2026-08-27). Data as JSON: /api/errors/ba8cfe11b63e1676. Report an issue: GitHub.