glanceapp/glance · error

getting swap memory info: %v

Error message

getting swap memory info: %v

What it means

Error "getting swap memory info: %v" thrown in glanceapp/glance.

Source

Thrown at pkg/sysinfo/sysinfo.go:198

	memory, err := mem.VirtualMemory()
	if err == nil {
		info.Memory.IsAvailable = true
		info.Memory.TotalMB = memory.Total / 1024 / 1024
		info.Memory.UsedMB = memory.Used / 1024 / 1024
		info.Memory.UsedPercent = uint8(math.Min(memory.UsedPercent, 100))
	} else {
		addErr(fmt.Errorf("getting memory info: %v", err))
	}

	swapMemory, err := mem.SwapMemory()
	if err == nil {
		info.Memory.SwapIsAvailable = true
		info.Memory.SwapTotalMB = swapMemory.Total / 1024 / 1024
		info.Memory.SwapUsedMB = swapMemory.Used / 1024 / 1024
		info.Memory.SwapUsedPercent = uint8(math.Min(swapMemory.UsedPercent, 100))
	} else {
		addErr(fmt.Errorf("getting swap memory info: %v", err))
	}

	// currently disabled on Windows because it requires elevated privilidges, otherwise
	// keeps returning a single sensor with key "ACPI\\ThermalZone\\TZ00_0" which
	// doesn't seem to be the CPU sensor or correspond to anything useful when
	// compared against the temperatures Libre Hardware Monitor reports.
	// Also disabled on the bsd's because it's not implemented by go-psutil for them
	if runtime.GOOS != "windows" && runtime.GOOS != "openbsd" && runtime.GOOS != "netbsd" && runtime.GOOS != "freebsd" {
		sensorReadings, err := sensors.SensorsTemperatures()
		_, errIsWarning := err.(*sensors.Warnings)
		if err == nil || errIsWarning {
			if req.CPUTempSensor != "" {
				for i := range sensorReadings {
					if sensorReadings[i].SensorKey == req.CPUTempSensor {
						info.CPU.TemperatureIsAvailable = true
						info.CPU.TemperatureC = uint8(sensorReadings[i].Temperature)
						break
					}

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Ensure the system exposes swap memory information readable by the process (check /proc/swaps and /proc/meminfo permissions).
  2. If the host has no swap configured, this error is expected; ignore it or disable swap collection.
  3. On containers or restricted environments, run with sufficient privileges or mount /proc so gopsutil can read swap stats.

When it happens

Trigger: Occurs when the system cannot read swap memory information from /proc/meminfo or the sysinfo syscall fails, typically on minimal containers or restricted environments.

Common situations: Running inside a container without /proc mounted, on a host with swap disabled reporting inconsistencies, or on an OS where swap metrics are unavailable.


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