Billionmail/BillionMail · error

user not exists:

Error message

user not exists: 

What it means

Chown resolves the username via GetUidAndGid (os/user Lookup). If lookup fails or resolves to uid==0 or gid==0, it returns "user not exists: <username>". The zero-check also (perhaps unintentionally) rejects root, since root has UID/GID 0.

Solutions

  1. Create the user on the system (useradd) or fix the username in config
  2. If root is intended, call ChownWithUidAndGidRecursive(path, 0, 0) directly
  3. Check NSS/LDAP configuration if the user exists but lookups fail inside the container

Example fix

// before
public.Chown(dir, "root") // rejected: uid/gid are 0
// after
public.ChownWithUidAndGidRecursive(dir, 0, 0) // explicit chown to root
Defensive patterns

Strategy: validation

Validate before calling

func userResolvable(name string) bool {
    uid, gid := public.GetUidAndGid(name)
    return uid != 0 || gid != 0
}

Type guard

func isValidUser(name string) bool {
    _, err := user.Lookup(name)
    return err == nil && name != "root"
}

Try / catch

if err := public.Chown(path, username); err != nil {
    if strings.Contains(err.Error(), "user not exists") {
        return fmt.Errorf("system user %q missing on this host; run provisioning", username)
    }
    return err
}

Prevention

When it happens

Trigger: Calling Chown(path, username) where the username does not exist on the host, the user DB (LDAP/NSS) is unreachable, or the username is "root" (uid/gid 0 is treated as not-found).

Common situations: Config references a service user (e.g. www, vmail) that was never created in the container; user exists only in the host but not inside the Docker image; root ownership intended but blocked by the zero check.

Related errors


AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05). Data as JSON: /api/errors/26692f4848bc3608. Report an issue: GitHub.

Appendix: source

Thrown at core/internal/service/public/common.go:1482

	if err != nil {
		return err
	}

	gid := gconv.Int(grp.Gid)

	if gid < 1 {
		return errors.New("group not exists: " + groupName)
	}

	return os.Chown(path, -1, gid)
}

// Change owner of a file or directory (recursive)
func Chown(path, username string) error {
	uid, gid := GetUidAndGid(username)

	if uid == 0 || gid == 0 {
		return errors.New("user not exists: " + username)
	}

	return ChownWithUidAndGidRecursive(path, uid, gid)
}

// Change owner of a file or directory with UID and GID (recursive)
func ChownWithUidAndGidRecursive(path string, uid, gid int) error {
	// File does not exist
	if !FileExists(path) {
		return errors.New("file not exists: " + path)
	}

	// Directory
	if IsDir(path) {
		ds, err := os.ReadDir(path)

		if err != nil {
			return err

View on GitHub (pinned to fc36c76c05)