bug: openshell CLI fails on Windows — HOME environment variable not set
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 8.7k
- Forks
- 1.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 253
Description
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
- Install OpenShell on Windows
- Run any
openshellCLI command (e.g.,openshell --helporopenshell sandbox create) - 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 7e0cce40)
Logs
Error: HOME is not set
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with crates/openshell-core/src/paths.rs, then trace the HOME lookups listed in openshell-cli/src/run.rs and ssh.rs, crates/openshell-core/src/config.rs, and the provider, server, and driver files. Check how each call site handles missing HOME and identify the shared path-resolution behavior. Done means Windows home-directory resolution works across the listed CLI and core paths without the "HOME is not set" error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100