Hmbown/CodeWhale · warning · io::Error

<legacy home resolution error>

Error message

<legacy home resolution error>

What it means

`merge_missing_legacy_session_entries` (crates/tui/src/session_manager.rs:3089) resolves the legacy `~/.deepseek` home via `codewhale_config::legacy_deepseek_home()` to migrate old sessions into `~/.codewhale/sessions`. If the legacy home cannot be resolved, the error becomes an io::Error (kind NotFound) whose message is the resolver's text. It only matters on migration; when CODEWHALE_HOME is explicitly set the legacy merge is skipped entirely.

Solutions

  1. Inspect the wrapped message and repair the legacy home path/permissions it complains about.
  2. Set CODEWHALE_HOME explicitly — the legacy migration path is then skipped and sessions resolve directly.
  3. Manually copy the needed session entries from ~/.deepseek/sessions into ~/.codewhale/sessions.

Example fix

// environment
// before: unset / broken home
// after
export CODEWHALE_HOME="$HOME/.codewhale"
Defensive patterns

Strategy: fallback

Validate before calling

let legacy_ok = !std::env::var_os("CODEWHALE_HOME").is_some()
    && Path::new("~/.deepseek").expand().is_dir();

Try / catch

match default_sessions_dir() {
    Err(e) if e.kind() == io::ErrorKind::NotFound => {
        // fall back: skip migration, use primary dir directly
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling default_sessions_dir when CODEWHALE_HOME is NOT explicitly set (so legacy merge runs) and legacy_deepseek_home() fails to resolve the old home directory.

Common situations: Upgraded installation where the old ~/.deepseek directory was deleted while home resolution depends on it; unusual $HOME configurations during migration; environment where the legacy path cannot be constructed.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/ca8a1f1db1d26f29. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/session_manager.rs:3089

        }
        Err(err) => {
            tracing::warn!(
                target: "session::migration",
                "Could not copy legacy sessions into {}: {err}",
                dir.display()
            );
        }
    }
    Ok(dir)
}

fn merge_missing_legacy_session_entries(primary: &Path) -> io::Result<usize> {
    if codewhale_paths::codewhale_home_is_explicit() {
        return Ok(0);
    }

    let legacy = codewhale_config::legacy_deepseek_home()
        .map_err(|e| io::Error::new(io::ErrorKind::NotFound, e.to_string()))?
        .join("sessions");
    if !legacy.is_dir() || paths_equivalent(primary, &legacy) {
        return Ok(0);
    }

    copy_missing_dir_entries(&legacy, primary)
}

fn copy_missing_dir_entries(src: &Path, dst: &Path) -> io::Result<usize> {
    fs::create_dir_all(dst)?;
    let mut copied = 0;
    for entry in fs::read_dir(src)? {
        let entry = entry?;
        let source = entry.path();
        let target = dst.join(entry.file_name());

        let file_type = entry.file_type()?;
        if file_type.is_dir() {

View on GitHub (pinned to 73e0f67d83)