{"record":{"id":"9af9dd8b35f4cf7c","repo":"kubernetes/kops","slug":"group-q-not-found","errorCode":null,"errorMessage":"group %q not found","messagePattern":"group %q not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/files_owner.go","lineNumber":59,"sourceCode":"\t\tuser, err := LookupUser(owner) // user.Lookup(owner)\n\t\tif err != nil {\n\t\t\treturn changed, fmt.Errorf(\"error looking up user %q: %v\", owner, err)\n\t\t}\n\t\tif user == nil {\n\t\t\treturn changed, fmt.Errorf(\"user %q not found\", owner)\n\t\t}\n\t\tuserID = user.Uid\n\t}\n\n\tactualGroupID := int(stat.Sys().(*syscall.Stat_t).Gid)\n\tgroupID := actualGroupID\n\tif groupName != \"\" {\n\t\tgroup, err := LookupGroup(groupName)\n\t\tif err != nil {\n\t\t\treturn changed, fmt.Errorf(\"error looking up group %q: %v\", groupName, err)\n\t\t}\n\t\tif group == nil {\n\t\t\treturn changed, fmt.Errorf(\"group %q not found\", groupName)\n\t\t}\n\t\tgroupID = group.Gid\n\t}\n\n\tif actualUserID == userID && actualGroupID == groupID {\n\t\treturn changed, nil\n\t}\n\n\tklog.Infof(\"Changing file owner/group for %q to %s:%s\", destPath, owner, groupName)\n\terr = os.Lchown(destPath, userID, groupID)\n\tif err != nil {\n\t\treturn changed, fmt.Errorf(\"error setting file owner/group for %q: %v\", destPath, err)\n\t}\n\tchanged = true\n\n\treturn changed, nil\n}\n","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/files_owner.go#L41-L77","documentation":"EnsureFileOwner requires the requested group to exist on the local machine before changing file ownership. If LookupGroup returns no error but a nil group, kops fails with this explicit 'not found' error rather than silently skipping the chown. It is the group-side analogue of the user-not-found check.","triggerScenarios":"RenderLocal on a file task whose group names a group absent from the local group database; LookupGroup(groupName) returns (nil, nil).","commonSituations":"Spec references a group (e.g. 'kube') that only exists on cluster nodes, not the machine running kOps; image or container lacking system groups; renamed/removed group after upgrade.","solutions":["Create the missing group: `sudo groupadd <name>`","Correct the group field in the spec to an existing group","Confirm resolution with `getent group <name>`","Leave group empty in the spec to preserve current group ownership"],"exampleFix":"// before\nensureFileOwner(path, \"root\", \"kube\")\n// after\nsudo groupadd kube  # or ensureFileOwner(path, \"root\", \"\")","handlingStrategy":"validation","validationCode":"g, _ := user.LookupGroup(group); if g == nil { return fmt.Errorf(\"group %q not found; run groupadd %s or clear the group field\", group, group) }","typeGuard":null,"tryCatchPattern":"if _, err := fi.EnsureFileOwner(path, owner, group); err != nil { if strings.Contains(err.Error(), \"group\") && strings.Contains(err.Error(), \"not found\") { return fi.EnsureFileOwner(path, owner, \"\") } return err }","preventionTips":["Create all referenced groups on machines that run kOps rendering","List required users/groups in cluster docs/ansible playbooks","Use `getent group <name>` as a preflight check"],"tags":["filesystem","permissions","group-lookup"],"backgroundTag":"group-not-found","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}