{"record":{"id":"b5419aa3a598ad33","repo":"prometheus/node_exporter","slug":"no-cpu-power-status-has-been-recorded","errorCode":null,"errorMessage":"no CPU power status has been recorded","messagePattern":"no CPU power status has been recorded","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"collector/thermal_darwin.go","lineNumber":138,"sourceCode":"\t\tch <- c.cpuAvailableCPU.mustNewConstMetric(float64(value))\n\t}\n\tif value, ok := cpuPowerStatus[(string(C.kIOPMCPUPowerLimitProcessorSpeedKey))]; ok {\n\t\tch <- c.cpuSpeedLimit.mustNewConstMetric(float64(value) / 100.0)\n\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)","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/thermal_darwin.go#L120-L156","documentation":"fetchCPUPowerStatus on macOS queries IOKit for the CPU power status dictionary; when IOKit returns kIOReturnNotFound the exporter has no recorded CPU power status and returns this error. It is distinct from other IOKit error codes, which produce a hex-code error instead.","triggerScenarios":"Update -> fetchCPUPowerStatus when the IOService (AppleSMC power-status style) dictionary lookup returns kIOReturnNotFound, i.e., the key has never been recorded by the SMC.","commonSituations":"Virtual machines or Hackintosh/unsupported hardware where the SMC does not publish CPU power status; macOS on platforms lacking the specific SMC key.","solutions":["Accept the absence: run the thermal collector only on supported Apple hardware, or disable it via --collector.thermal.","Verify SMC availability on the host (real Mac hardware required); on VMs the metric cannot exist.","Check for macOS updates/SMC firmware updates that might publish the key."],"exampleFix":"// before\nstatus, err := fetchCPUPowerStatus(logger) // errors on VMs\n// after\nstatus, err := fetchCPUPowerStatus(logger)\nif err != nil {\n    logger.Debug(\"CPU power status unavailable\", \"err\", err)\n    return nil // skip metric instead of failing collection\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"status, err := fetchCPUPowerStatus(logger)\nif err != nil {\n    if err.Error() == \"no CPU power status has been recorded\" {\n        logger.Debug(\"CPU power status not available on this hardware\")\n        return nil\n    }\n    return err\n}","preventionTips":["Enable the thermal collector only on real Apple hardware.","Skip SMC-based collectors inside VMs.","Treat kIOReturnNotFound as 'metric not applicable', not a scrape failure."],"tags":["go","darwin","macos","smc","thermal"],"backgroundTag":"unsupported-platform","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"}