{"record":{"id":"aaab97ff2a5f5e54","repo":"juicedata/juicefs","slug":"user-s-group-s-not-found","errorCode":null,"errorMessage":"user(%s):group(%s) not found","messagePattern":"user\\((.+?)\\):group\\((.+?)\\) not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/object.go","lineNumber":379,"sourceCode":"\t}\n\t// No mapping for Go's ModeTemporary (plan9 only).\n\treturn\n}\n\nfunc (j *juiceFS) Chmod(key string, mode os.FileMode) error {\n\tf, err := j.jfs.Open(ctx, j.path(key), 0)\n\tif err != 0 {\n\t\treturn err\n\t}\n\tdefer f.Close(ctx)\n\treturn toError(f.Chmod(ctx, uint16(syscallMode(mode))))\n}\n\nfunc (j *juiceFS) Chown(key string, owner, group string) error {\n\tuid := utils.LookupUser(owner)\n\tgid := utils.LookupGroup(group)\n\tif uid == -1 || gid == -1 {\n\t\treturn fmt.Errorf(\"user(%s):group(%s) not found\", owner, group)\n\t}\n\tf, err := j.jfs.Lopen(ctx, j.path(key), 0)\n\tif err != 0 {\n\t\treturn err\n\t}\n\tdefer f.Close(ctx)\n\treturn toError(f.Chown(ctx, uint32(uid), uint32(gid)))\n}\n\nfunc (j *juiceFS) Symlink(oldName, newName string) error {\n\tp := j.path(newName)\n\terr := j.jfs.Symlink(ctx, oldName, p)\n\tif err == syscall.ENOENT {\n\t\tif err = j.jfs.MkdirAll(ctx, path.Dir(p), 0777, j.umask); err != 0 {\n\t\t\treturn toError(err)\n\t\t}\n\t\terr = j.jfs.Symlink(ctx, oldName, p)\n\t}","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/object.go#L361-L397","documentation":"jfs.Chown resolves owner and group names to uid/gid via utils.LookupUser/LookupGroup on the machine running the client; if either lookup fails (-1), it returns 'user(%s):group(%s) not found'. The names must exist in the local user/group database (/etc/passwd, /etc/group, NSS).","triggerScenarios":"Chown(key, owner, group) where owner or group is not a valid local user/group name, e.g. owner from S3 canned ACL strings or IDs that don't map to local accounts.","commonSituations":"S3 gateway/sync carrying owner/group names from another machine's accounts; chown of objects copied from a different host with unknown uid/gid; containers lacking the user/group entries; LDAP/NSS not configured.","solutions":["Create the missing user/group locally (useradd/groupadd) or add entries to /etc/passwd and /etc/group.","Pass numeric-friendly or existing names understood by the host running JuiceFS.","If in a container, ensure the user/group exists inside the container image.","Check NSS/LDAP configuration so name lookups succeed."],"exampleFix":"// before\nstore.Chown(key, \"alice\", \"devs\") // names unknown on this host\n// after\nerr := store.Chown(key, \"alice\", \"devs\")\nif err != nil && strings.Contains(err.Error(), \"not found\") {\n    // fall back to current owner or create the accounts first\n}","handlingStrategy":"validation","validationCode":"if utils.LookupUser(owner) == -1 || utils.LookupGroup(group) == -1 {\n    return fmt.Errorf(\"cannot chown: %s:%s unknown on this host\", owner, group)\n}","typeGuard":null,"tryCatchPattern":"if err := store.Chown(key, owner, group); err != nil {\n    log.Warnf(\"chown failed, keeping current ownership: %v\", err)\n}","preventionTips":["Ensure the user/group exists on the host (or container) running JuiceFS.","Prefer numeric uid/gid mapping tools when migrating across machines.","Configure NSS/LDAP so name lookups succeed.","Don't assume account names from another host resolve locally."],"tags":["chown","user-lookup","permissions","juicefs"],"backgroundTag":"user-not-found","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}