Hmbown/CodeWhale · error

Failed to resolve tui.toml path: no Codewhale home found.

Error message

Failed to resolve tui.toml path: no Codewhale home found.

What it means

Raised in tui_prefs_path_from_environment: neither the config_override_parent escape hatch nor codewhale_config::codewhale_home() yielded a home directory, so there is nowhere to place tui.toml. The companion resolve_tui_prefs_path_from_candidates falls back to legacy candidates; this error is the terminal case where primary and legacy homes are both absent.

Source

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

    pub fn validate(&mut self) -> Result<()> {
        self.theme = normalize_theme_setting(&self.theme).map_err(anyhow::Error::msg)?;
        Ok(())
    }
}

fn tui_prefs_path_from_environment() -> Result<PathBuf> {
    // Honour the same env-var escape hatch used by Settings::path so that
    // integration tests can redirect all config I/O to a temp directory.
    if let Some(parent) = config_override_parent() {
        return Ok(parent.join("tui.toml"));
    }

    let primary = codewhale_config::codewhale_home()
        .ok()
        .map(|home| home.join(TUI_PREFS_FILE_NAME));
    if codewhale_config::codewhale_home_is_explicit() {
        return primary.ok_or_else(|| {
            anyhow::anyhow!("Failed to resolve tui.toml path: no Codewhale home found.")
        });
    }
    let legacy_home = codewhale_config::legacy_deepseek_home()
        .ok()
        .map(|home| home.join(TUI_PREFS_FILE_NAME));

    resolve_tui_prefs_path_from_candidates(primary, legacy_home)
}

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());
    }

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Set HOME (or the platform equivalent) so codewhale_home() resolves
  2. Use the env-var override the function honours (config_override_parent) to redirect config I/O to a writable directory
  3. Create the expected home directory with correct permissions
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/tui/src/settings.rs:248 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/bdda0079824102a8. Report an issue: GitHub.