{"record":{"id":"1c4005129fd0c1d9","repo":"ClementTsang/bottom","slug":"unsupported-os","errorCode":null,"errorMessage":"Unsupported OS","messagePattern":"Unsupported OS","errorType":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/collection/disks.rs","lineNumber":94,"sourceCode":"            for io in io_stats()?.into_iter() {\n                let mount_point = io.device_name().to_string_lossy();\n\n                io_hash.insert(\n                    mount_point.to_string(),\n                    Some(IoData {\n                        read_bytes: io.read_bytes(),\n                        write_bytes: io.write_bytes(),\n                    }),\n                );\n            }\n\n            Ok(io_hash)\n        }\n    }\n    not(target_os = \"freebsd\") => {\n        use crate::collection::DataCollector;\n        pub fn get_io_usage(_collector: &DataCollector) -> anyhow::Result<IoHarvest> {\n            anyhow::bail!(\"Unsupported OS\");\n        }\n    }\n    _ => {}\n}\n\n/// Whether to keep the current disk entry given the filters, disk name, and\n/// disk mount. Precedence ordering in the case where name and mount filters\n/// disagree, \"allow\" takes precedence over \"deny\".\n///\n/// For implementation, we do this as follows:\n///\n/// 1. Is the entry allowed through any filter? That is, does it match an entry\n///    in a filter where `is_list_ignored` is `false`? If so, we always keep\n///    this entry.\n/// 2. Is the entry denied through any filter? That is, does it match an entry\n///    in a filter where `is_list_ignored` is `true`? If so, we always deny this\n///    entry.\n/// 3. Anything else is allowed.","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/ClementTsang/bottom/blob/b77d3175028849824e987c35177e8f61450d72e7/src/collection/disks.rs#L76-L112","documentation":"get_io_usage on unsupported platforms (anything other than the specifically implemented OSes, e.g. not Linux, macOS, or FreeBSD in the target cfg) is a stub that immediately returns an error. It signals that disk I/O statistics harvesting is simply not implemented for the current operating system.","triggerScenarios":"Calling get_io_usage (disk I/O harvest) while compiling/running on an OS that falls into the catch-all cfg branch, e.g. Windows or any target that is not freebsd/covered by other branches.","commonSituations":"Running the app on an unusual platform (e.g. NetBSD, Illumos) or after a Rust target/cfg change that no longer matches the implemented platform branches.","solutions":["Verify the host OS is one with disk I/O support (Linux, macOS, FreeBSD)","Gate I/O usage collection behind an OS check before calling","Contribute/implement an IoHarvest collector for the target OS","Handle the returned error gracefully and skip I/O metrics"],"exampleFix":"// before\nlet io = get_io_usage(&collector)?;\n// after\nmatch get_io_usage(&collector) {\n    Ok(h) => Some(h),\n    Err(e) if e.to_string().contains(\"Unsupported OS\") => { log::warn!(\"io stats unsupported here\"); None },\n    Err(e) => return Err(e),\n}","handlingStrategy":"try-catch","validationCode":"// Skip I/O collection on unsupported targets\n#[cfg(not(any(target_os = \"linux\", target_os = \"macos\", target_os = \"freebsd\")))]\nlet io_harvest: Option<IoHarvest> = None;","typeGuard":null,"tryCatchPattern":"match get_io_usage(&collector) {\n    Ok(h) => Some(h),\n    Err(e) if e.to_string() == \"Unsupported OS\" => { log::info!(\"io stats not supported on this OS\"); None },\n    Err(e) => return Err(e),\n}","preventionTips":["Check the supported-OS matrix before enabling disk I/O metrics","Gate features per-OS with cfg attributes","Gracefully degrade metrics on unsupported platforms"],"tags":["unsupported-platform","disks","io"],"backgroundTag":"unsupported-platform","analyzedSha":"b77d3175028849824e987c35177e8f61450d72e7","analyzedAt":"2026-09-07T14:53:21.246Z","contentChangedAt":"2026-09-07T14:53:21.246Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}