glanceapp/glance · warning

getting host info

Error message

getting host info: %v

What it means

Non-fatal collection error in pkg/sysinfo: getHostInfo() (hostname/platform detection) failed and is recorded via addErr instead of aborting, so the server-stats widget degrades gracefully. The Info struct is returned with host fields unset and one more message in the combined error.

Solutions

  1. Check the combined error's other components to see how much of sysinfo still succeeded
  2. For containers, expose /etc/hostname and /etc/os-release or relax the sandbox
  3. Treat as cosmetic if only host metadata is missing and stats you need still render
Defensive patterns

Strategy: fallback

Type guard

func isSysinfoHostErr(err error) bool {
	return err != nil && strings.Contains(err.Error(), "getting host info")
}

Try / catch

info, err := sysinfo.Get()
if err != nil {
    // sysinfo aggregates: partial data is still usable, host fields are just unset
    if !info.HostnameSet() { /* skip host panel */ }
    slog.Warn("partial sysinfo", "err", err)
}

Prevention

When it happens

Trigger: Host introspection failing: hostname lookup error, /etc or WMI/registry read failure depending on OS, or a restricted container where host identity syscalls are blocked.

Common situations: Hardened containers dropping the needed capabilities; /etc/hostname missing in minimal images; Windows systems with WMI service issues.

Related errors


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

Appendix: source

Thrown at pkg/sysinfo/sysinfo.go:154

		Mountpoints: []MountpointInfo{},
	}

	applyCachedHostInfo := func() {
		info.HostInfoIsAvailable = true
		info.BootTime = cachedHostInfo.bootTime
		info.Hostname = cachedHostInfo.hostname
		info.Platform = cachedHostInfo.platform
	}

	if cachedHostInfo.available {
		applyCachedHostInfo()
	} else {
		hostInfo, err := getHostInfo()
		if err == nil {
			cachedHostInfo = hostInfo
			applyCachedHostInfo()
		} else {
			addErr(fmt.Errorf("getting host info: %v", err))
		}
	}

	coreCount, err := cpu.Counts(true)
	if err == nil {
		loadAvg, err := load.Avg()
		if err == nil {
			info.CPU.LoadIsAvailable = true
			if runtime.GOOS == "windows" {
				// The numbers returned here seem unreliable on Windows. Even with the CPU pegged
				// at close to 50% for multiple minutes, load1 is sometimes way under or way over
				// with no clear pattern. Dividing by core count gives numbers that are way too
				// low so that's likely not necessary as it is with unix.
				info.CPU.Load1Percent = uint8(math.Min(loadAvg.Load1*100, 100))
				info.CPU.Load15Percent = uint8(math.Min(loadAvg.Load15*100, 100))
			} else {
				info.CPU.Load1Percent = uint8(math.Min((loadAvg.Load1/float64(coreCount))*100, 100))
				info.CPU.Load15Percent = uint8(math.Min((loadAvg.Load15/float64(coreCount))*100, 100))

View on GitHub (pinned to 91324e8de7)