glanceapp/glance · warning

invalid first day of week

Error message

invalid first day of week

What it means

The System widget config lets you pin the CPU temperature to a specific sensor key (cpu-temp-sensor in widget options). Glance enumerates sensors via gopsutil's SensorsTemperatures() and matches each reading's SensorKey against the configured name; if nothing matches, it records 'CPU temperature sensor %s not found' and leaves TemperatureIsAvailable false.

Source

Thrown at internal/glance/widget-calendar.go:34

	"thursday":  time.Thursday,
	"friday":    time.Friday,
	"saturday":  time.Saturday,
}

type calendarWidget struct {
	widgetBase     `yaml:",inline"`
	FirstDayOfWeek string        `yaml:"first-day-of-week"`
	FirstDay       int           `yaml:"-"`
	cachedHTML     template.HTML `yaml:"-"`
}

func (widget *calendarWidget) initialize() error {
	widget.withTitle("Calendar").withError(nil)

	if widget.FirstDayOfWeek == "" {
		widget.FirstDayOfWeek = "monday"
	} else if _, ok := calendarWeekdaysToInt[widget.FirstDayOfWeek]; !ok {
		return errors.New("invalid first day of week")
	}

	widget.FirstDay = int(calendarWeekdaysToInt[widget.FirstDayOfWeek])
	widget.cachedHTML = widget.renderTemplate(widget, calendarWidgetTemplate)

	return nil
}

func (widget *calendarWidget) Render() template.HTML {
	return widget.cachedHTML
}

View on GitHub (pinned to 91324e8de7)

Solutions

  1. On the host, run: cat /sys/class/hwmon/hwmon*/name and ls /sys/class/hwmon/hwmon*/temp*_label to list real sensor keys
  2. Correct or remove the cpu-temp-sensor field in the System widget config so Glance falls back to inferCPUTempSensor() auto-detection
  3. After kernel updates, re-check the sensor key since hwmon numbering can change across boots
  4. On a VM, confirm a virtual thermal sensor is exposed at all; many hypervisors expose none

Example fix

// before (glance.yml)
- type: system
  cpu-temp-sensor: coretemp_packageid_0
// after: let Glance infer the sensor
- type: system
  # cpu-temp-sensor omitted, inferCPUTempSensor picks a sensible one
Defensive patterns

Strategy: validation

Validate before calling

readings, err := sensors.SensorsTemperatures()
if err == nil {
    found := false
    for _, r := range readings {
        if r.SensorKey == configuredSensor { found = true; break }
    }
    if !found {
        // list valid keys for the user
        for _, r := range readings { fmt.Println("available:", r.SensorKey) }
    }
}

Prevention

When it happens

Trigger: req.CPUTempSensor is set (e.g. cpu-temp-sensor: coretemp_packageid_0) but no returned reading has that exact SensorKey. Happens after a kernel/driver change renames hwmon entries, after adding/removing hardware, or simply from a typo.

Common situations: Copying a sensor name from another machine or blog post (keys are host-specific like k10temp_tctl or coretemp_packageid_0), upgrading the kernel so the hwmon device renumbers (hwmon2 -> hwmon3), or sensors being exposed under a different label on virtual machines.

Related errors


AI-assisted analysis of glanceapp/glance@91324e8de7 (2026-08-15). Data as JSON: /api/errors/f7ef0fb9230f126d. Report an issue: GitHub.