jdx/mise · error
only available on unix
Error message
only available on unix
What it means
Parts of mise's system module resolve the invoking user (name, shell) from the Unix user database, honoring SUDO_USER for privilege drops. On non-Unix builds (Windows) that code is cfg'd out and target_user() immediately bails with unavailable_reason(), the literal message being 'only available on unix' (src/system/login_shell.rs:106). It is a hard platform gate: no fallback user lookup exists on Windows.
Source
Thrown at src/system/login_shell.rs:106
fn target_user() -> Result<nix::unistd::User> {
use eyre::eyre;
use nix::unistd::{User, geteuid};
if geteuid().is_root()
&& let Ok(sudo_user) = crate::env::var("SUDO_USER")
&& !sudo_user.is_empty()
&& sudo_user != "root"
{
return User::from_name(&sudo_user)?
.ok_or_else(|| eyre!("failed to find user from SUDO_USER={sudo_user}"));
}
let uid = geteuid();
User::from_uid(uid)?.ok_or_else(|| eyre!("failed to find user for uid {uid}"))
}
#[cfg(not(unix))]
fn target_user() -> Result<TargetUser> {
eyre::bail!("{}", unavailable_reason())
}
#[cfg(not(unix))]
struct TargetUser {
name: String,
shell: PathBuf,
}
fn display_shell(shell: PathBuf) -> String {
shell.to_string_lossy().to_string()
}
#[cfg(unix)]
fn chsh_args(request: &LoginShellRequest, user: &nix::unistd::User) -> Vec<String> {
chsh_args_for_user_name(request, &user.name)
}
#[cfg(unix)]View on GitHub (pinned to 6f52dcdf99)
Solutions
- Run the affected flow on macOS/Linux/WSL, where the user database lookup exists
- On Windows, remove or gate the config sections that require unix user resolution so they are not evaluated
- Split shared config so unix-only bootstrap sections live in OS-specific files mise does not load on Windows
Example fix
# before (shared mise.toml used on Windows) [bootstrap.hooks.post-user] run = "./setup-user.sh" # after: move unix-only sections to e.g. mise.macos.toml / mise.linux.toml # and keep the Windows-used mise.toml free of unix-user-dependent phases
Defensive patterns
Strategy: fallback
Validate before calling
# gate unix-only bootstrap flows by OS before invoking them uname -s | grep -qE 'Darwin|Linux' || echo "skip unix-only mise bootstrap flow on $(uname -s)"
Type guard
import platform
def supports_unix_user_lookup() -> bool:
return platform.system() in ("Linux", "Darwin") Prevention
- Split config by OS (e.g. mise.macos.toml / mise.linux.toml) so Windows never evaluates unix-only sections
- Treat 'only available on unix' as a platform gate, not a transient error — do not retry it
- Run unix-dependent flows inside WSL on Windows machines
When it happens
Trigger: Running a mise command/bootstrap flow that needs the login shell or target user (e.g. bootstrap phases that execute as the resolved user) on a Windows build of mise. The #[cfg(not(unix))] target_user is invoked and bails immediately.
Common situations: Windows machines running `mise bootstrap` with config that exercises unix-only subsystems; CI matrices including Windows against shared mise.toml files; trying user/privilege features on Windows where only a subset of bootstrap is supported.
Related errors
- TEMP is too long to replace mise.exe safely ({len} UTF-16 co
- `defaults {display}` failed: {}
- `defaults {}` failed: {}
- conflicting bootstrap service declarations for {name}\n\n f
- managed path '{}' notifies unconfigured bootstrap service '{
AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22).
Data as JSON: /api/errors/566f286d4dd58350.
Report an issue: GitHub.