juicedata/juicefs · error

user(%s):group(%s) not found

Error message

user(%s):group(%s) not found

What it means

nfsStore.Chown resolves the owner and group names to uid/gid via utils.LookupUser/LookupGroup; if either lookup returns -1 (name unknown on the local system), it refuses to set attributes and reports which names were not found.

Source

Thrown at pkg/object/nfs.go:402

	})
}

func (n *nfsStore) Chmod(path string, mode os.FileMode) error {
	return n.setAttr(path, func(attr *nfs.Fattr) nfs.Sattr3 {
		return nfs.Sattr3{
			Mode: nfs.SetMode{
				SetIt: true,
				Mode:  uint32(mode),
			},
		}
	})
}

func (n *nfsStore) Chown(path string, owner, group string) error {
	uid := utils.LookupUser(owner)
	gid := utils.LookupGroup(group)
	if uid == -1 || gid == -1 {
		return fmt.Errorf("user(%s):group(%s) not found", owner, group)
	}
	return n.setAttr(path, func(attr *nfs.Fattr) nfs.Sattr3 {
		return nfs.Sattr3{
			UID: nfs.SetUID{
				SetIt: true,
				UID:   uint32(uid),
			},
			GID: nfs.SetUID{
				SetIt: true,
				UID:   uint32(gid),
			},
		}
	})
}

func (n *nfsStore) Symlink(oldName, newName string) error {
	newName = strings.TrimRight(newName, "/")
	p := n.path(newName)

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Create the missing user or group on the local machine (useradd/groupadd) before chowning.
  2. Chown using names that resolve locally, or run as a user whose database contains them.
  3. Check /etc/passwd and /etc/group (or NSS) on the client host; in containers, add the user/group to the image.

Example fix

// before
store.Chown("/a/b", "appuser", "appgroup") // not present locally
// after
// on the client host:
// sudo groupadd -g 1005 appgroup && sudo useradd -u 1005 -g appgroup appuser
store.Chown("/a/b", "appuser", "appgroup")
Defensive patterns

Strategy: validation

Validate before calling

if _, err := user.Lookup(owner); err != nil {
	return fmt.Errorf("owner %q does not exist locally", owner)
}
if _, err := user.LookupGroup(group); err != nil {
	return fmt.Errorf("group %q does not exist locally", group)
}

Try / catch

if err := store.Chown(path, owner, group); err != nil && strings.Contains(err.Error(), "not found") {
	log.Printf("create user/group %s:%s locally before chown", owner, group)
}

Prevention

When it happens

Trigger: Calling Chown on an NFS object store with an owner or group name that does not exist in the local user/group database, e.g. Chown(path, "appuser", "appgroup") where either name is missing locally.

Common situations: Username/group valid on the NFS server but not on the client performing the chown; typos; running in a container with a minimal /etc/passwd and /etc/group.

Understand the failure class

Background: "User not found", "Invalid user", and "does not exist": what missing-user lookup errors mean across Rocket.Chat, LiteLLM, Phabricator, rustfs, and pnpm — this error's family across 10 libraries.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/2d7cc93a6cd98319. Report an issue: GitHub.