{"record":{"id":"a80099da4108d5e9","repo":"glanceapp/glance","slug":"getting-host-info-v","errorCode":null,"errorMessage":"getting host info: %v","messagePattern":"getting host info: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/sysinfo/sysinfo.go","lineNumber":154,"sourceCode":"\t\tMountpoints: []MountpointInfo{},\n\t}\n\n\tapplyCachedHostInfo := func() {\n\t\tinfo.HostInfoIsAvailable = true\n\t\tinfo.BootTime = cachedHostInfo.bootTime\n\t\tinfo.Hostname = cachedHostInfo.hostname\n\t\tinfo.Platform = cachedHostInfo.platform\n\t}\n\n\tif cachedHostInfo.available {\n\t\tapplyCachedHostInfo()\n\t} else {\n\t\thostInfo, err := getHostInfo()\n\t\tif err == nil {\n\t\t\tcachedHostInfo = hostInfo\n\t\t\tapplyCachedHostInfo()\n\t\t} else {\n\t\t\taddErr(fmt.Errorf(\"getting host info: %v\", err))\n\t\t}\n\t}\n\n\tcoreCount, err := cpu.Counts(true)\n\tif err == nil {\n\t\tloadAvg, err := load.Avg()\n\t\tif err == nil {\n\t\t\tinfo.CPU.LoadIsAvailable = true\n\t\t\tif runtime.GOOS == \"windows\" {\n\t\t\t\t// The numbers returned here seem unreliable on Windows. Even with the CPU pegged\n\t\t\t\t// at close to 50% for multiple minutes, load1 is sometimes way under or way over\n\t\t\t\t// with no clear pattern. Dividing by core count gives numbers that are way too\n\t\t\t\t// low so that's likely not necessary as it is with unix.\n\t\t\t\tinfo.CPU.Load1Percent = uint8(math.Min(loadAvg.Load1*100, 100))\n\t\t\t\tinfo.CPU.Load15Percent = uint8(math.Min(loadAvg.Load15*100, 100))\n\t\t\t} else {\n\t\t\t\tinfo.CPU.Load1Percent = uint8(math.Min((loadAvg.Load1/float64(coreCount))*100, 100))\n\t\t\t\tinfo.CPU.Load15Percent = uint8(math.Min((loadAvg.Load15/float64(coreCount))*100, 100))","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/glanceapp/glance/blob/91324e8de762702e97b0ac5c8e36271d644d8642/pkg/sysinfo/sysinfo.go#L136-L172","documentation":"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.","triggerScenarios":"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.","commonSituations":"Hardened containers dropping the needed capabilities; /etc/hostname missing in minimal images; Windows systems with WMI service issues.","solutions":["Check the combined error's other components to see how much of sysinfo still succeeded","For containers, expose /etc/hostname and /etc/os-release or relax the sandbox","Treat as cosmetic if only host metadata is missing and stats you need still render"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":"func isSysinfoHostErr(err error) bool {\n\treturn err != nil && strings.Contains(err.Error(), \"getting host info\")\n}","tryCatchPattern":"info, err := sysinfo.Get()\nif err != nil {\n    // sysinfo aggregates: partial data is still usable, host fields are just unset\n    if !info.HostnameSet() { /* skip host panel */ }\n    slog.Warn(\"partial sysinfo\", \"err\", err)\n}","preventionTips":["Expect sysinfo errors to be aggregated and non-fatal — design the UI around IsAvailable flags","In containers, expose /etc/hostname and /etc/os-release for reliable host detection"],"tags":["sysinfo","server-stats","container","host-detection"],"backgroundTag":null,"analyzedSha":"91324e8de762702e97b0ac5c8e36271d644d8642","analyzedAt":"2026-08-15T14:12:54.279Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}