{"record":{"id":"74673bfb5313f9db","repo":"jdx/mise","slug":"error-74673b","errorCode":null,"errorMessage":"{}","messagePattern":"\\{\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/login_shell.rs","lineNumber":106,"sourceCode":"fn target_user() -> Result<nix::unistd::User> {\n    use eyre::eyre;\n    use nix::unistd::{User, geteuid};\n\n    if geteuid().is_root()\n        && let Ok(sudo_user) = crate::env::var(\"SUDO_USER\")\n        && !sudo_user.is_empty()\n        && sudo_user != \"root\"\n    {\n        return User::from_name(&sudo_user)?\n            .ok_or_else(|| eyre!(\"failed to find user from SUDO_USER={sudo_user}\"));\n    }\n    let uid = geteuid();\n    User::from_uid(uid)?.ok_or_else(|| eyre!(\"failed to find user for uid {uid}\"))\n}\n\n#[cfg(not(unix))]\nfn target_user() -> Result<TargetUser> {\n    eyre::bail!(\"{}\", unavailable_reason())\n}\n\n#[cfg(not(unix))]\nstruct TargetUser {\n    name: String,\n    shell: PathBuf,\n}\n\nfn display_shell(shell: PathBuf) -> String {\n    shell.to_string_lossy().to_string()\n}\n\n#[cfg(unix)]\nfn chsh_args(request: &LoginShellRequest, user: &nix::unistd::User) -> Vec<String> {\n    chsh_args_for_user_name(request, &user.name)\n}\n\n#[cfg(unix)]","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/login_shell.rs#L88-L124","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"#[cfg(unix)]\nfn login_shell_supported() -> bool { true }\n#[cfg(not(unix))]\nfn login_shell_supported() -> bool { false }","typeGuard":null,"tryCatchPattern":"match target_user() {\n    Err(e) if !cfg!(unix) => {\n        // fall back to $SHELL / configured default shell\n        let shell = std::env::var(\"SHELL\").unwrap_or_else(|_| \"/bin/sh\".into());\n        ...\n    }\n    other => other?,\n}","preventionTips":["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."],"tags":["platform","unsupported","unix","login-shell"],"backgroundTag":"unsupported-platform","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}