{"record":{"id":"a19d89c99b0f7739","repo":"henrygd/beszel","slug":"no-sensors-found-try-running-as-admin-with-lhm-tr","errorCode":null,"errorMessage":"no sensors found (try running as admin with LHM=true)","messagePattern":"no sensors found \\(try running as admin with LHM=true\\)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"agent/sensors_windows.go","lineNumber":52,"sourceCode":"\tstdout               io.ReadCloser\n\tscanner              *bufio.Scanner\n\tisRunning            bool\n\tstoppedNoSensors     bool\n\tconsecutiveNoSensors uint8\n\texecPath             string\n\ttempDir              string\n}\n\n//go:embed all:lhm/bin/Release/net48\nvar lhmFs embed.FS\n\nvar (\n\tbeszelLhm     *lhmProcess\n\tbeszelLhmOnce sync.Once\n\tuseLHM        = os.Getenv(\"LHM\") == \"true\"\n)\n\nvar errNoSensors = errors.New(\"no sensors found (try running as admin with LHM=true)\")\n\n// newlhmProcess copies the embedded LHM executable to a temporary directory and starts it.\nfunc newlhmProcess() (*lhmProcess, error) {\n\tdestDir := filepath.Join(os.TempDir(), \"beszel\")\n\texecPath := filepath.Join(destDir, \"beszel_lhm.exe\")\n\n\tif err := os.MkdirAll(destDir, 0755); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create temp directory: %w\", err)\n\t}\n\n\t// Only copy if executable doesn't exist\n\tif _, err := os.Stat(execPath); os.IsNotExist(err) {\n\t\tif err := copyEmbeddedDir(lhmFs, \"lhm/bin/Release/net48\", destDir); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to copy embedded directory: %w\", err)\n\t\t}\n\t}\n\n\tlhm := &lhmProcess{","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/henrygd/beszel/blob/b38fb7dafa60812cc22e6a84ce313e94f1ce0a32/agent/sensors_windows.go#L34-L70","documentation":"errNoSensors is returned by getTemps on Windows when no temperature sensor readings could be collected. On Windows, temperature data requires WMI or the bundled LibreHardwareMonitor (LHM) helper executable, both of which typically need administrator privileges. The agent returns this error when the sensor enumeration comes back empty, hinting at the LHM fallback.","triggerScenarios":"getTemps is called on a Windows agent, neither WMI thermal zone queries nor the LHM helper return any sensors: LHM env var not set, LHM binary failed to start, or the process lacks admin rights so the kernel driver cannot read sensors.","commonSituations":"Running the beszel agent as a regular user on Windows; the LHM executable blocked by antivirus or missing from the temp directory; sensors genuinely absent in VMs (e.g. Hyper-V guests report no thermal data); forgetting to set LHM=true when WMI returns nothing.","solutions":["Re-run the agent process with administrator privileges","Set environment variable LHM=true so the agent launches the embedded LibreHardwareMonitor helper","Check that beszel_lhm.exe is created in the temp dir (antivirus may block it) and re-copy if missing","Accept the limitation on VMs/hardware that exposes no sensors; hide the temperature metric for that system"],"exampleFix":"// before\n./beszel-agent.exe\n// after\nLHM=true ./beszel-agent.exe  # run from an elevated shell","handlingStrategy":"fallback","validationCode":"// before relying on temps on Windows\nif runtime.GOOS == \"windows\" && os.Getenv(\"LHM\") != \"true\" {\n    log.Println(\"hint: set LHM=true and run elevated for temperature data\")\n}","typeGuard":null,"tryCatchPattern":"temps, err := getTemps(ctx)\nif errors.Is(err, errNoSensors) {\n    log.Warn(\"temperature sensors unavailable; skipping\")\n    return nil // continue without temps\n}","preventionTips":["Run the agent elevated (as admin/service) on Windows","Set LHM=true when the host exposes no WMI thermal zones","Whitelist beszel_lhm.exe in antivirus to prevent blocking","Disable the temp metric for VMs without sensors"],"tags":["windows","sensors","admin-privileges","lhm"],"backgroundTag":"missing-admin-privileges","analyzedSha":"b38fb7dafa60812cc22e6a84ce313e94f1ce0a32","analyzedAt":"2026-08-31T15:10:10.149Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}