{"record":{"id":"a21ecfde2a0fc90b","repo":"ClementTsang/bottom","slug":"missing-device","errorCode":null,"errorMessage":"missing device","messagePattern":"missing device","errorType":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"src/collection/disks/unix/linux/partition.rs","lineNumber":130,"sourceCode":"\n    s.replace(ESCAPED_BACKSLASH, \"\\\\\")\n        .replace(ESCAPED_SPACE, \" \")\n        .replace(ESCAPED_TAB, \"\\t\")\n        .replace(ESCAPED_NEWLINE, \"\\n\")\n}\n\nimpl FromStr for Partition {\n    type Err = anyhow::Error;\n\n    fn from_str(line: &str) -> anyhow::Result<Partition> {\n        // Example: `/dev/sda3 /home ext4 rw,relatime,data=ordered 0 0`\n        let mut parts = line.trim_start().splitn(5, ' ');\n\n        let device = match parts.next() {\n            Some(\"none\") => None,\n            Some(device) => Some(device.to_string()),\n            None => {\n                bail!(\"missing device\");\n            }\n        };\n\n        let mount_point = match parts.next() {\n            Some(mount_point) => PathBuf::from(fix_mount_point(mount_point)),\n            None => {\n                bail!(\"missing mount point\");\n            }\n        };\n        let fs_type = match parts.next() {\n            Some(fs) => FileSystem::from_str(fs)?,\n            _ => {\n                bail!(\"missing filesystem type\");\n            }\n        };\n\n        Ok(Partition {\n            device,","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/ClementTsang/bottom/blob/b77d3175028849824e987c35177e8f61450d72e7/src/collection/disks/unix/linux/partition.rs#L112-L148","documentation":"Partition::from_str parses a line from /proc/mounts (or /etc/mtab) via splitn(5, ' '). This error fires when the line has no first token at all (i.e. an empty line), so no device field can be extracted.","triggerScenarios":"Calling Partition::from_str with an empty or whitespace-only string, which happens when reading /proc/mounts yields blank lines.","commonSituations":"Reading mount tables that end with a trailing newline, or passing empty input from a custom mounts source.","solutions":["Filter out empty lines before parsing each mount entry","Trim and skip blank lines when reading /proc/mounts","Check the mounts file source isn't truncated or unreadable"],"exampleFix":"// before\nfor line in content.lines() {\n    let p = Partition::from_str(line)?;\n// after\nfor line in content.lines().filter(|l| !l.trim().is_empty()) {\n    let p = Partition::from_str(line)?;","handlingStrategy":"validation","validationCode":"// Skip blank lines before parsing mounts entries\nlet entries: Vec<Partition> = std::fs::read_to_string(\"/proc/mounts\")?\n    .lines()\n    .filter(|l| !l.trim().is_empty())\n    .filter_map(|l| Partition::from_str(l).ok())\n    .collect();","typeGuard":null,"tryCatchPattern":"match Partition::from_str(line) {\n    Ok(p) => Some(p),\n    Err(e) => { log::debug!(\"skipping line: {e}\"); None },\n}","preventionTips":["Filter empty lines from /proc/mounts before parsing","Never pass user-trimmed empty strings to parsers","Log-and-skip malformed mount lines in production"],"tags":["linux","parsing","mounts","empty-input"],"backgroundTag":"schema-validation-failed","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"}