{"record":{"id":"f404407c28cd9bd9","repo":"prometheus/node_exporter","slug":"collector-diskstats-ignored-devices-and-collec","errorCode":null,"errorMessage":"--collector.diskstats.ignored-devices and --collector.diskstats.device-exclude are mutually exclusive","messagePattern":"--collector\\.diskstats\\.ignored-devices and --collector\\.diskstats\\.device-exclude are mutually exclusive","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/diskstats_common.go","lineNumber":99,"sourceCode":"\t\tdiskLabelNames,\n\t\tnil,\n\t)\n\n\twriteTimeSecondsDesc = prometheus.NewDesc(\n\t\tprometheus.BuildFQName(namespace, diskSubsystem, \"write_time_seconds_total\"),\n\t\t\"This is the total number of seconds spent by all writes.\",\n\t\tdiskLabelNames,\n\t\tnil,\n\t)\n)\n\nfunc newDiskstatsDeviceFilter(logger *slog.Logger) (deviceFilter, error) {\n\tif *oldDiskstatsDeviceExclude != \"\" {\n\t\tif !diskstatsDeviceExcludeSet {\n\t\t\tlogger.Warn(\"--collector.diskstats.ignored-devices is DEPRECATED and will be removed in 2.0.0, use --collector.diskstats.device-exclude\")\n\t\t\t*diskstatsDeviceExclude = *oldDiskstatsDeviceExclude\n\t\t} else {\n\t\t\treturn deviceFilter{}, errors.New(\"--collector.diskstats.ignored-devices and --collector.diskstats.device-exclude are mutually exclusive\")\n\t\t}\n\t}\n\tif *diskstatsDeviceInclude != \"\" {\n\t\tif diskstatsDeviceExcludeSet && *diskstatsDeviceExclude != \"\" {\n\t\t\treturn deviceFilter{}, errors.New(\"device-exclude & device-include are mutually exclusive\")\n\t\t}\n\t\t*diskstatsDeviceExclude = \"\"\n\t}\n\n\tif *diskstatsDeviceExclude != \"\" {\n\t\tlogger.Info(\"Parsed flag --collector.diskstats.device-exclude\", \"flag\", *diskstatsDeviceExclude)\n\t}\n\n\tif *diskstatsDeviceInclude != \"\" {\n\t\tlogger.Info(\"Parsed Flag --collector.diskstats.device-include\", \"flag\", *diskstatsDeviceInclude)\n\t}\n\n\treturn newDeviceFilter(*diskstatsDeviceExclude, *diskstatsDeviceInclude), nil","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/diskstats_common.go#L81-L117","documentation":"In newDiskstatsDeviceFilter (diskstats_common.go), node_exporter refuses to start when both the deprecated --collector.diskstats.ignored-devices and the replacement --collector.diskstats.device-exclude are set, because it cannot tell which the operator intended. This is a startup-time configuration validation error raised by NewDiskstatsCollector.","triggerScenarios":"Both flags --collector.diskstats.ignored-devices (old, deprecated) and --collector.diskstats.device-exclude (new) are given non-empty values on the command line (oldDiskstatsDeviceExclude != \"\" AND diskstatsDeviceExcludeSet).","commonSituations":"Upgrading node_exporter and merging old service unit files with new documentation examples, leaving both flags in place; config-management tools (Puppet/Ansible) adding the new flag without removing the deprecated one.","solutions":["Remove --collector.diskstats.ignored-devices and keep only --collector.diskstats.device-exclude with the same regex value","If you truly want the old flag temporarily, unset --collector.diskstats.device-exclude entirely (presence of the flag counts, even with empty value semantics differ)","Search your unit file/container args/config management for both flags and keep exactly one"],"exampleFix":"// before\nnode_exporter --collector.diskstats.ignored-devices='^(ram|loop)\\d+$' --collector.diskstats.device-exclude='^(zram)\\d+$'\n// after\nnode_exporter --collector.diskstats.device-exclude='^(ram|loop|zram)\\d+$'","handlingStrategy":"validation","validationCode":"# shell pre-flight before launching: only one of the two flags may be set\nargs=$(tr '\\0' '\\n' </proc/1/cmdline 2>/dev/null || true)\nif echo \"$args\" | grep -q 'ignored-devices=' && echo \"$args\" | grep -q 'diskstats.device-exclude='; then\n  echo \"conflict: drop --collector.diskstats.ignored-devices and use --collector.diskstats.device-exclude only\"\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize on --collector.diskstats.device-exclude; treat ignored-devices as removed","Add config-management assertions that only one flag is ever rendered","Grep service unit files/containers for both flags during upgrades","Write a startup smoke test that catches flag conflicts before production"],"tags":["cli-flags","configuration","diskstats","deprecated-flag"],"backgroundTag":"mutually-exclusive-flags","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"}