jdx/mise · error
{}
Error message
{} What it means
This error is returned by target_user on non-unix platforms, where resolving the current user's name and login shell is not supported. The message is the reason produced by unavailable_reason(), explaining why the feature cannot work on this platform. It prevents the login-shell detection code path from silently returning wrong data.
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 afd2eddd3a)
Solutions
- Read unavailable_reason() output in the message to confirm the platform limitation.
- Run the operation on a unix platform (macOS/Linux) if the feature is required.
- Configure the shell/user explicitly in settings if the tool offers an override, bypassing target_user detection.
- If you maintain the caller, gate the feature behind cfg(unix) or provide a Windows implementation.
Defensive patterns
Strategy: fallback
Validate before calling
#[cfg(unix)]
fn login_shell_supported() -> bool { true }
#[cfg(not(unix))]
fn login_shell_supported() -> bool { false } Try / catch
match target_user() {
Err(e) if !cfg!(unix) => {
// fall back to $SHELL / configured default shell
let shell = std::env::var("SHELL").unwrap_or_else(|_| "/bin/sh".into());
...
}
other => other?,
} Prevention
- Feature-gate login-shell-dependent functionality with cfg(unix).
- Provide an explicit config override for shell/user on unsupported platforms.
- Document platform requirements so Windows users don't hit the dead end.
When it happens
Trigger: Any call into login_shell::target_user() (and thus higher-level login-shell lookup APIs) compiled/running on a non-unix platform (e.g. Windows), where the cfg(not(unix)) branch is active.
Common situations: Running the tool on Windows when a feature assumes POSIX user/shell detection; CI images or cross-platform builds where the login-shell feature is exercised on an unsupported OS.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- only available on unix
- Unsupported OS '{}'. Supported: linux, macos, windows, andro
- mise oci build does not support asdf/vfox plugins in v1 (the
- unsupported env: {}/{} (supported: {:?})
- Unsupported forge type {:?}
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/74673bfb5313f9db.
Report an issue: GitHub.