Skip to content

bug: openshell CLI fails on Windows — HOME environment variable not set #2028

Description

@jeffmaury

Agent Diagnostic

Loaded skill: create-github-issue. Ran codebase-wide grep for HOME env var usage.

Findings: The CLI (and core path resolution) unconditionally reads HOME, which does not exist on Windows (Windows uses USERPROFILE, HOMEDRIVE/HOMEPATH). Key call sites:

File Line(s) Usage
crates/openshell-core/src/paths.rs 23, 41, 59 xdg_config_dir(), xdg_state_dir(), xdg_data_dir() — all error with "HOME is not set"
crates/openshell-cli/src/run.rs 738 std::env::var_os("HOME") fallback for XDG_STATE_HOME
crates/openshell-cli/src/run.rs 4354-4355 gcloud ADC file resolution — errors with "HOME is not set"
crates/openshell-cli/src/ssh.rs 1457-1459 SSH config path — errors with "HOME is not set"
crates/openshell-core/src/config.rs 164, 219 Podman/Docker socket candidates
crates/openshell-providers/src/providers/opencode.rs 21-28 opencode_config_path() fallback
crates/openshell-server/src/compute/vm.rs 238 Driver search directory
crates/openshell-driver-vm/src/driver.rs 3232 macOS podman socket path

No USERPROFILE, HOMEDRIVE, or HOMEPATH handling exists anywhere in the codebase. The entire XDG path-resolution layer assumes a Unix-like HOME.

Description

Actual behavior: Running openshell on Windows fails immediately because std::env::var("HOME") returns an error. The HOME environment variable is not set by default on Windows — Windows uses USERPROFILE (e.g., C:\Users\<name>) instead.

Expected behavior: The CLI should resolve the user's home directory on all supported platforms, falling back to USERPROFILE on Windows (or using Rust's dirs::home_dir() / std::env::home_dir()).

Reproduction Steps

  1. Install OpenShell on Windows
  2. Run any openshell CLI command (e.g., openshell --help or openshell sandbox create)
  3. Observe error: "HOME is not set"

Environment

  • OS: Windows 11 Pro 10.0.26100
  • Docker: N/A (crash occurs before Docker interaction)
  • OpenShell: main branch (commit 7e0cce4)

Logs

Error: HOME is not set

Metadata

Metadata

Assignees

No one assigned

    Labels

    state:triage-neededOpened without agent diagnostics and needs triage

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions