prometheus/node_exporter · error

host_processor_info error=

Error message

host_processor_info error=%d

What it means

On macOS the CPU collector queries per-CPU load via the Mach host_processor_info call. A non-KERN_SUCCESS return status means the Mach kernel refused or failed the request; the raw kernel status code is embedded in the message so the specific reason (privilege, invalid host, resource shortage) can be identified.

Solutions

  1. Run the exporter outside of sandboxed/restricted environments so it can access Mach host information
  2. Check the embedded status code to identify the Mach failure (e.g. KERN_INVALID_ARGUMENT vs privilege issues)
  3. If Mach access cannot be granted, disable the cpu collector on macOS

Example fix

// before
sandbox-exec ... node_exporter  # host_processor_info denied
// after
run node_exporter as a normal launchd service without sandbox restrictions
Defensive patterns

Strategy: retry

Try / catch

if err := cpu.Update(ch); err != nil {
    if strings.Contains(err.Error(), "host_processor_info error=") {
        // likely sandbox/privilege issue — do not hot-retry
        log.Warn("mach host info unavailable; check sandbox", "err", err)
        return nil
    }
    return err
}

Prevention

When it happens

Trigger: C.host_processor_info(host, PROCESSOR_CPU_LOAD_INFO, ...) returns a status other than KERN_SUCCESS during the cpu collector's Update().

Common situations: Sandboxed execution (App Sandbox/seccomp-like profiles) denying Mach host ports; running under environments with restricted task ports (e.g. hardened macOS, containers runningDarwin-side); kernel resource exhaustion.

Related errors


AI-assisted analysis of prometheus/node_exporter@17ddd77c59 (2026-09-07). Data as JSON: /api/errors/2f004a8dd6c7dca7. Report an issue: GitHub.

Appendix: source

Thrown at collector/cpu_darwin.go:84

		logger: logger,
	}, nil
}

func (c *statCollector) Update(ch chan<- prometheus.Metric) error {
	var (
		count   C.mach_msg_type_number_t
		cpuload *C.processor_cpu_load_info_data_t
		ncpu    C.natural_t
	)

	status := C.host_processor_info(C.host_t(C.mach_host_self()),
		C.PROCESSOR_CPU_LOAD_INFO,
		&ncpu,
		(*C.processor_info_array_t)(unsafe.Pointer(&cpuload)),
		&count)

	if status != C.KERN_SUCCESS {
		return fmt.Errorf("host_processor_info error=%d", status)
	}

	// jump through some cgo casting hoops and ensure we properly free
	// the memory that cpuload points to
	target := C.vm_map_t(C.mach_task_self_)
	address := C.vm_address_t(uintptr(unsafe.Pointer(cpuload)))
	defer C.vm_deallocate(target, address, C.vm_size_t(ncpu))

	// the body of struct processor_cpu_load_info
	// aka processor_cpu_load_info_data_t
	var cpuTicks [C.CPU_STATE_MAX]uint32

	// copy the cpuload array to a []byte buffer
	// where we can binary.Read the data
	size := int(ncpu) * binary.Size(cpuTicks)
	buf := (*[1 << 30]byte)(unsafe.Pointer(cpuload))[:size:size]

	bbuf := bytes.NewBuffer(buf)

View on GitHub (pinned to 17ddd77c59)