astrid-runtime/astrid · warning

native capacity query is unavailable on this platform

Error message

native capacity query is unavailable on this platform

What it means

volume_info::snapshot collects native filesystem capacity/usage data for a mount root. On non-Unix targets the platform-specific statvfs-style implementation does not exist, so the non-unix snapshot stub unconditionally returns io::ErrorKind::Unsupported with this message.

Source

Thrown at crates/astrid-kernel/src/storage_mount/volume_info.rs:66

        "available_blocks": available,
        "created_secs": timestamp(metadata.created()),
        "modified_secs": timestamp(metadata.modified()),
    }))
    .map_err(io::Error::other)
}

#[cfg(unix)]
fn timestamp(value: io::Result<std::time::SystemTime>) -> Option<u64> {
    value
        .ok()?
        .duration_since(std::time::UNIX_EPOCH)
        .ok()
        .map(|value| value.as_secs())
}

#[cfg(not(unix))]
fn snapshot(_root: &std::path::Path) -> io::Result<Vec<u8>> {
    Err(io::Error::new(
        io::ErrorKind::Unsupported,
        "native capacity query is unavailable on this platform",
    ))
}

#[cfg(all(test, unix))]
mod tests {
    use super::*;

    #[test]
    fn reports_actual_backing_capacity_and_configured_label() {
        use std::os::unix::fs::MetadataExt;
        let root = tempfile::tempdir().unwrap();
        std::fs::write(root.path().join("astrid.volume"), [42; 8192]).unwrap();
        std::fs::write(
            root.path().join("config.toml"),
            "[filesystem]\nvolume_name = 'AOS'\n",
        )

View on GitHub (pinned to affd8760f4)

Solutions

  1. Run on a Unix platform (Linux/macOS/BSD) where the native capacity query is implemented
  2. Guard the caller behind #[cfg(unix)] or a runtime capability check and degrade gracefully when unavailable
  3. Implement a non-unix snapshot() using the platform's native API (e.g. GetDiskFreeSpaceExW on Windows)
  4. Fall back to reporting unknown capacity instead of treating this as fatal

Example fix

// before
let info = volume_info::snapshot(&root)?;
// after
let info = match volume_info::snapshot(&root) {
    Ok(info) => Some(info),
    Err(e) if e.kind() == io::ErrorKind::Unsupported => None,
    Err(e) => return Err(e.into()),
};
Defensive patterns

Strategy: fallback

Validate before calling

#[cfg(unix)]
fn capacity_query_available() -> bool { true }
#[cfg(not(unix))]
fn capacity_query_available() -> bool { false }

Try / catch

match volume_info::snapshot(&root) {
    Ok(info) => info,
    Err(e) if e.kind() == io::ErrorKind::Unsupported => {
        VolumeInfo::unknown() // degrade gracefully on non-unix
    }
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: Calling snapshot() (or any volume-info query that relies on it) on a platform compiled without the unix cfg — e.g. Windows or WASM builds of astrid-kernel.

Common situations: Running the kernel on Windows where the capacity query was never ported; cross-compiling to a non-Unix target and exercising volume-info code paths; CI matrix hitting a non-Unix runner.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/3fd606123d6b498d. Report an issue: GitHub.