jdx/mise · error
cannot determine the current user to own
Error message
cannot determine the current user to own {prefix} What it means
bootstrap creates and chowns the brew prefix to the current user (or SUDO_USER under sudo mise). It deliberately refuses to guess an owner: prefix_owner() returns None when there is no invoking sudo user and the effective uid cannot be resolved to a username (e.g. plain root in a container without a passwd entry, or a deleted user). Chowning to a guessed owner could lock the real user out, so mise errors instead.
Solutions
- Run mise as a normal user instead of root, or ensure SUDO_USER is correct when using sudo
- Fix the container's /etc/passwd so the current uid maps to a username (e.g. ensure root:x:0:0:root:/root:/bin/sh exists)
- Pre-create the prefix yourself with correct ownership (mkdir + chown to your user) so bootstrap finds it writable and skips the chown path
Example fix
# before (docker) USER root RUN mise bootstrap packages apply # after RUN mkdir -p /home/linuxbrew/.linuxbrew && chown -R developer /home/linuxbrew USER developer
Defensive patterns
Strategy: validation
Validate before calling
u="${SUDO_USER:-$(id -un)}"
id "$u" >/dev/null 2>&1 || echo "owner user '$u' does not resolve — fix /etc/passwd or SUDO_USER" Prevention
- Run mise as a real named user, not bare root in passwd-less containers
- Ensure SUDO_USER points to an existing account when using sudo mise
- Pre-create and chown the brew prefix in image builds so bootstrap never needs to determine an owner
When it happens
Trigger: bootstrap needs to create the prefix or chown it (needs_create || needs_chown) but prefix_owner() returns None — running as plain root with no SUDO_USER and no passwd entry for uid 0's name lookup, or SUDO_USER names a nonexistent user.
Common situations: `sudo mise ...` where SUDO_USER is set to a user deleted from /etc/passwd; docker run as root in minimal images with an empty/broken /etc/passwd; nixpkgs/static-linking edge cases where nix::unistd::User::from_uid fails.
Related errors
- brew-cask: staging directory is not owned by the current…
- cannot determine the current user to own
- is still not writable after bootstrap
- path component was concurrently created by another user
- app Info.plist must be a regular file
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/a88c5aad89849ab5.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/packages/brew/prefix.rs:204
let missing_subdirs: Vec<PathBuf> = dirs.iter().filter(|p| !p.exists()).cloned().collect();
if !needs_create && !needs_chown && missing_subdirs.is_empty() {
return Ok(());
}
// try without elevation first — covers prefixes under user-writable
// parents; the real prefixes need sudo to create. Skipped under `sudo
// mise`: root could create the dirs, but they must be chowned to the
// invoking user afterwards
if needs_create
&& !dry_run
&& sudo_invoking_user().is_none()
&& dirs.iter().try_for_each(std::fs::create_dir_all).is_ok()
{
return Ok(());
}
if needs_create || needs_chown {
let Some(user) = prefix_owner() else {
// never chown to a guessed owner — that can lock the user out
bail!(
"cannot determine the current user to own {}",
prefix.display()
);
};
// brew's install.sh chowns to user:admin on macOS, just the user on
// Linux (the admin group doesn't exist there)
let owner = if cfg!(target_os = "macos") {
format!("{user}:admin")
} else {
user
};
let mut mkdir_dirs: Vec<String> = vec![prefix.to_string_lossy().to_string()];
mkdir_dirs.extend(dirs.iter().map(|d| d.display().to_string()));
let mkdir_args: Vec<String> = ["-p".to_string()].into_iter().chain(mkdir_dirs).collect();
let chown_args: Vec<String> = vec!["-R".to_string(), owner, prefix.display().to_string()];
if dry_run {
miseprintln!("{}", sudo::argv("mkdir", &mkdir_args).join(" "));
miseprintln!("{}", sudo::argv("chown", &chown_args).join(" "));View on GitHub (pinned to 533346cc37)