{"record":{"id":"93db849e83811c1a","repo":"prometheus/node_exporter","slug":"no-cpu-power-status-with-error-code-0x-08x","errorCode":null,"errorMessage":"no CPU power status with error code 0x%08x","messagePattern":"no CPU power status with error code 0x%08x","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/thermal_darwin.go","lineNumber":142,"sourceCode":"\t}\n\n\treturn c.updateTemperatures(ch)\n}\n\nfunc fetchCPUPowerStatus() (map[string]int, error) {\n\tcfDictRef, _ := C.FetchThermal()\n\tdefer func() {\n\t\tif cfDictRef.ref != 0x0 {\n\t\t\tC.CFRelease(C.CFTypeRef(cfDictRef.ref))\n\t\t}\n\t}()\n\n\tif C.kIOReturnNotFound == cfDictRef.ret {\n\t\treturn nil, errors.New(\"no CPU power status has been recorded\")\n\t}\n\n\tif C.kIOReturnSuccess != cfDictRef.ret {\n\t\treturn nil, fmt.Errorf(\"no CPU power status with error code 0x%08x\", int(cfDictRef.ret))\n\t}\n\n\t// mapping CFDictionary to map\n\tcfDict := CFDict(cfDictRef.ref)\n\treturn mappingCFDictToMap(cfDict), nil\n}\n\ntype CFDict uintptr\n\nfunc mappingCFDictToMap(dict CFDict) map[string]int {\n\tif C.CFNullRef(dict) == C.kCFNull {\n\t\treturn nil\n\t}\n\tcfDict := C.CFDictionaryRef(dict)\n\n\tvar result map[string]int\n\tcount := C.CFDictionaryGetCount(cfDict)\n\tif count > 0 {","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/thermal_darwin.go#L124-L160","documentation":"This error comes from the macOS thermal collector when the IOKit CPU power status query returns a failure other than kIOReturnNotFound. The collector reads the CPU power status dictionary from IOKit via cgo; any IOReturn code other than success (and other than the specifically-handled 'not recorded' case) is wrapped into this message with the code in hex. It signals that IOKit itself rejected or failed the query rather than simply having no recorded status.","triggerScenarios":"Calling fetchCPUPowerStatus (via thermalCollector.Update) when C.kIOReturnSuccess != cfDictRef.ret and the code is not kIOReturnNotFound, e.g. IOKit privilege/entitlement failures or driver-level errors on macOS.","commonSituations":"Running node_exporter on a macOS host where the power-management IOKit service denies access (unsandboxed vs sandboxed contexts), on virtual machines that don't emulate Apple's SMC/power status keys, or on macOS versions where the kIOSCPUStatusKey dictionary is unavailable and the driver returns an unexpected IOReturn code.","solutions":["Check the printed 0x%08x code against IOKit IOReturn.h (e.g. 0xe00002c7 = kIOReturnNotPrivileged) to identify the failure cause.","Re-run the exporter without sandbox/restriction so IOKit power queries are permitted.","Disable the thermal collector (or this platform path) on hosts/VMs known not to expose CPU power status.","Verify the macOS/IOKit version supports the CPU power status dictionary; treat it as platform-specific and degrade gracefully."],"exampleFix":"// before\nreturn nil, fmt.Errorf(\"no CPU power status with error code 0x%08x\", int(cfDictRef.ret))\n// after\nif C.kIOReturnNotPrivileged == cfDictRef.ret {\n    return nil, ErrNoData // degrade instead of failing the scrape\n}\nreturn nil, fmt.Errorf(\"no CPU power status with error code 0x%08x\", int(cfDictRef.ret))","handlingStrategy":"try-catch","validationCode":"// Go: check the wrapped IOReturn code before deciding how to handle\nvar errKIOReturnNotPrivileged = errors.New(\"kIOReturnNotPrivileged\")\nif strings.Contains(err.Error(), \"error code 0xe00002c7\") { /* privileged query unavailable */ }","typeGuard":"func isCPUPowerStatusCode(err error) (uint32, bool) {\n    var code uint32\n    if _, e := fmt.Sscanf(err.Error(), \"no CPU power status with error code 0x%08x\", &code); e == nil {\n        return code, true\n    }\n    return 0, false\n}","tryCatchPattern":"if _, err := collector.Update(ch); err != nil {\n    if errors.Is(err, ErrNoData) {\n        return // skip scrape, expected on unsupported Macs\n    }\n    log.Printf(\"thermal collector unavailable: %v\", err) // degrade, don't crash\n}","preventionTips":["Treat CPU power status metrics as optional on macOS; always handle scrape errors per-collector.","Log the hex IOReturn code and map it to IOKit IOReturn.h constants for diagnosis.","Run exporters unsandboxed when IOKit queries are needed.","Test on both physical Macs and VMs to catch platform differences."],"tags":["macos","iokit","thermal","cgo"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"17ddd77c59ba27e1508e9f7894b1e55b44d6aed3","analyzedAt":"2026-09-07T17:54:06.211Z","contentChangedAt":"2026-09-07T17:54:06.211Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}