ClementTsang/bottom · warning · anyhow::Error

missing mount point

Error message

missing mount point

What it means

This error means the FromStr parser for Partition failed while parsing a line from /proc/mounts (e.g. '/dev/sda3 /home ext4 rw,relatime,data=ordered 0 0'): after reading the first whitespace-separated field as the device, the iterator produced no second field, so no mount point exists in the line. It fires only when the caller passes a malformed line with fewer than 2 space-separated tokens (a generic sentinel guard in the splitn(5, ' ') parsing loop) — i.e. a truncated or empty line, not a real /proc/mounts entry. Callers should treat it as malformed-input data for one mount entry; parsing continues/propagates via anyhow::Result.

Solutions

  1. Skip blank or short lines when reading /proc/mounts instead of parsing them.
  2. Log the offending line and continue so one bad mount entry doesn't abort the whole disk collection.
  3. If constructing Partition manually, always supply device, mount point, and filesystem type fields.

Example fix

Skip empty/short lines before parsing: for line in content.lines().filter(|l| !l.trim().is_empty() && l.split_whitespace().count() >= 3) { let p = Partition::from_str(line)?; }
Defensive patterns

Strategy: validation

Validate before calling

// Require at least 4 fields before parsing a mounts line
let ok = line.split_whitespace().count() >= 4;
if !ok { eprintln!("malformed mounts line: {line:?}"); }

Try / catch

let p = Partition::from_str(line)
    .map_err(|e| { log::debug!("bad mount entry {line:?}: {e}"); e })
    .unwrap_or_else(|_| Partition::default_placeholder());

Prevention

When it happens

Trigger: An empty or blank line, or a line with only one token (e.g. '/dev/sda3'), is passed to Partition::from_str, so splitn yields no second field for the mount point.

Common situations: Reading /proc/mounts returns a stray blank or truncated line (e.g. buffered trailing newline), or hand-crafted/partial input is fed to the parser during tests or debugging.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of ClementTsang/bottom@b77d317502 (2026-09-07). Data as JSON: /api/errors/d4ebefe66bcf5fa9. Report an issue: GitHub.

Appendix: source

Thrown at src/collection/disks/unix/linux/partition.rs:137

impl FromStr for Partition {
    type Err = anyhow::Error;

    fn from_str(line: &str) -> anyhow::Result<Partition> {
        // Example: `/dev/sda3 /home ext4 rw,relatime,data=ordered 0 0`
        let mut parts = line.trim_start().splitn(5, ' ');

        let device = match parts.next() {
            Some("none") => None,
            Some(device) => Some(device.to_string()),
            None => {
                bail!("missing device");
            }
        };

        let mount_point = match parts.next() {
            Some(mount_point) => PathBuf::from(fix_mount_point(mount_point)),
            None => {
                bail!("missing mount point");
            }
        };
        let fs_type = match parts.next() {
            Some(fs) => FileSystem::from_str(fs)?,
            _ => {
                bail!("missing filesystem type");
            }
        };

        Ok(Partition {
            device,
            mount_point,
            fs_type,
        })
    }
}

#[expect(dead_code)]

View on GitHub (pinned to b77d317502)