astrid-runtime/astrid · warning

the Unix Astrid home is resolved from HOME

Error message

the Unix Astrid home is resolved from HOME

What it means

On non-Windows targets, default_astrid_home_root() deliberately returns io::ErrorKind::Unsupported. The Unix Astrid home follows the established `$HOME/.astrid` contract, which is resolved by crate::dirs::AstridHome, so this function refuses to compute an alternative root. It exists only to give Windows a per-user LocalAppData root.

Solutions

  1. On Unix, resolve the home via crate::dirs::AstridHome (the $HOME/.astrid contract) instead of this function.
  2. Branch on cfg!(windows) and only call default_astrid_home_root() on Windows.
  3. If you need a fallback, read the HOME environment variable explicitly and join ".astrid".

Example fix

// before
let root = platform_fs::default_astrid_home_root()?;
// after
let root = if cfg!(windows) {
    platform_fs::default_astrid_home_root()?
} else {
    dirs::home_dir().ok_or_else(|| io::Error::new(io::ErrorKind::NotFound, "HOME not set"))?.join(".astrid")
};
Defensive patterns

Strategy: fallback

Validate before calling

let root = if cfg!(windows) {
    platform_fs::default_astrid_home_root()
} else {
    std::env::var("HOME").map(|h| std::path::PathBuf::from(h).join(".astrid"))
        .map_err(|_| io::Error::new(io::ErrorKind::NotFound, "HOME not set"))
};

Type guard

fn is_windows() -> bool { cfg!(windows) }

Try / catch

match platform_fs::default_astrid_home_root() {
    Ok(root) => root,
    Err(e) if e.kind() == io::ErrorKind::Unsupported => dirs::home_dir().unwrap().join(".astrid"),
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling crates/astrid-core/src/platform_fs.rs::default_astrid_home_root() on any non-Windows target (Unix, macOS, or other cfg(not(windows)) builds).

Common situations: Portable code that calls the same home-root helper on every platform instead of branching; tests or tooling that assume one cross-platform API; code written against Windows behavior then compiled on Unix.

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/bb84a0190356d839. Report an issue: GitHub.

Appendix: source

Thrown at crates/astrid-core/src/platform_fs.rs:101

/// Return the platform's private per-user Astrid root.
///
/// Unix resolution remains in [`crate::dirs::AstridHome`] because its existing
/// `$HOME/.astrid` contract must not move. Windows uses the `LocalAppData` known
/// folder and never falls back to the current directory or a shared root.
///
/// # Errors
///
/// Returns an error if Windows cannot resolve a per-user `LocalAppData` folder or
/// if that folder is not a local absolute path.
pub fn default_astrid_home_root() -> io::Result<PathBuf> {
    #[cfg(windows)]
    {
        windows::default_astrid_home_root()
    }

    #[cfg(not(windows))]
    {
        Err(io::Error::new(
            io::ErrorKind::Unsupported,
            "the Unix Astrid home is resolved from HOME",
        ))
    }
}

/// Create a security-sensitive directory and enforce the platform's private
/// access policy.
///
/// Unix keeps Astrid's existing owner-only `0700` behavior. Windows installs a
/// protected DACL containing only the current user, `LocalSystem`, and the local
/// Administrators group, with inheritable full-control entries for children.
///
/// # Errors
///
/// Returns an error when the path cannot be created, is redirected through a
/// symlink or reparse point, or cannot be made private.
pub fn ensure_private_directory(path: &Path) -> io::Result<()> {

View on GitHub (pinned to affd8760f4)