{"record":{"id":"6953b21f5b809392","repo":"prometheus/node_exporter","slug":"unable-to-get-isolated-cpus-w","errorCode":null,"errorMessage":"unable to get isolated cpus: %w","messagePattern":"unable to get isolated cpus: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/cpu_linux.go","lineNumber":88,"sourceCode":"\tregisterCollector(\"cpu\", defaultEnabled, NewCPUCollector)\n}\n\n// NewCPUCollector returns a new Collector exposing kernel/system statistics.\nfunc NewCPUCollector(logger *slog.Logger) (Collector, error) {\n\tpfs, err := procfs.NewFS(*procPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open procfs: %w\", err)\n\t}\n\n\tsfs, err := sysfs.NewFS(*sysPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open sysfs: %w\", err)\n\t}\n\n\tisolcpus, err := sfs.IsolatedCPUs()\n\tif err != nil {\n\t\tif !os.IsNotExist(err) {\n\t\t\treturn nil, fmt.Errorf(\"unable to get isolated cpus: %w\", err)\n\t\t}\n\t\tlogger.Debug(\"couldn't open isolated file\", \"error\", err)\n\t}\n\n\tc := &cpuCollector{\n\t\tprocfs: pfs,\n\t\tsysfs:  sfs,\n\t\tcpu:    nodeCPUSecondsDesc,\n\t\tcpuInfo: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, cpuCollectorSubsystem, \"info\"),\n\t\t\t\"CPU information from /proc/cpuinfo.\",\n\t\t\t[]string{\"package\", \"core\", \"cpu\", \"vendor\", \"family\", \"model\", \"model_name\", \"microcode\", \"stepping\", \"cachesize\"}, nil,\n\t\t),\n\t\tcpuFrequencyHz: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, cpuCollectorSubsystem, \"frequency_hertz\"),\n\t\t\t\"CPU frequency in hertz from /proc/cpuinfo.\",\n\t\t\t[]string{\"package\", \"core\", \"cpu\"}, nil,\n\t\t),","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/cpu_linux.go#L70-L106","documentation":"After opening sysfs, NewCPUCollector reads the isolated CPU set (sfs.IsolatedCPUs(), backed by /sys/devices/system/cpu/isolated). If reading it fails for any reason other than os.ErrNotExist, the error is fatal and wrapped with this message; a missing file is tolerated (the feature simply isn't in use) and only logged at debug level.","triggerScenarios":"sfs.IsolatedCPUs() returns a non-ENOENT error, e.g. permission denied on /sys/devices/system/cpu/isolated or a malformed/unparseable CPU list.","commonSituations":"Hardened containers restricting /sys read access; sysfs mounted with unusual permissions; kernel/sysfs variants exposing the file in an unexpected format; bind-mounting a file (not the dir) over isolated.","solutions":["Ensure the exporter can read /sys/devices/system/cpu/isolated (check mount and file permissions)","If isolation is not used and the file is absent, no action needed — this error means a read failed despite the file existing","Update procfs/sysfs libraries (or the exporter) if the CPU-list format cannot be parsed"],"exampleFix":"// before\nisolcpus, err := sfs.IsolatedCPUs() // permission denied, fatal\n// after\nchmod / adjust container mounts: -v /sys:/host/sys:ro and --path.sysfs=/host/sys","handlingStrategy":"try-catch","validationCode":"// Go: probe the isolated file before relying on the feature\nif b, err := os.ReadFile(filepath.Join(*sysPath, \"devices/system/cpu/isolated\")); err != nil && !os.IsNotExist(err) {\n    log.Warn(\"cannot read isolated CPUs\", \"err\", err)\n} else {\n    _ = b\n}","typeGuard":"func isolatedReadable(sysPath string) bool {\n    _, err := os.ReadFile(filepath.Join(sysPath, \"devices/system/cpu/isolated\"))\n    return err == nil || os.IsNotExist(err)\n}","tryCatchPattern":"if err := run(); err != nil {\n    if strings.Contains(err.Error(), \"unable to get isolated cpus\") {\n        log.Warn(\"isolated CPU info unavailable; continuing without it\", \"err\", err)\n    } else {\n        return err\n    }\n}","preventionTips":["Keep /sys/devices/system/cpu world-readable in deployment images","Avoid partial bind-mounts that shadow the isolated file","Upgrade exporter/procfs if CPU-list parsing fails on your kernel"],"tags":["sysfs","cpu","isolated-cpus"],"backgroundTag":"file-read-failed","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"}