Hmbown/CodeWhale · error

Failed to resolve tui preferences path: no home directory fo

Error message

Failed to resolve tui preferences path: no home directory found.

What it means

Terminal failure inside resolve_tui_prefs_path_from_candidates: neither the primary nor the legacy-home candidate path exists, and at least one candidate Option was present but neither matched, leaving primary.or(legacy_home) empty only when both are None — i.e. no usable home directory exists to read or write tui.toml from.

Source

Thrown at crates/tui/src/settings.rs:275

fn resolve_tui_prefs_path_from_candidates(
    primary: Option<PathBuf>,
    legacy_home: Option<PathBuf>,
) -> Result<PathBuf> {
    if let Some(path) = primary.as_ref()
        && path.exists()
    {
        return Ok(path.clone());
    }

    if let Some(path) = legacy_home.as_ref()
        && path.exists()
    {
        return Ok(path.clone());
    }

    primary.or(legacy_home).ok_or_else(|| {
        anyhow::anyhow!("Failed to resolve tui preferences path: no home directory found.")
    })
}

/// User settings with defaults
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct PinnedModel {
    /// Exact configured provider identity; labels never replace this value.
    pub provider: String,
    /// Exact provider-owned model id.
    pub model: String,
    /// Optional presentation-only label.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub label: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(default)]
pub struct Settings {

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Set HOME/XDG home so a config directory exists
  2. Create the Codewhale home directory so the primary candidate becomes usable
  3. Point tests at a temp dir via the environment override instead of relying on a real home
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/tui/src/settings.rs:275 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/664e6eef28a81a33. Report an issue: GitHub.