{"record":{"id":"2a4e02fc39b8627a","repo":"AdguardTeam/AdGuardHome","slug":"looking-up-group-w","errorCode":null,"errorMessage":"looking up group: %w","messagePattern":"looking up group: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/aghos/user_unix.go","lineNumber":15,"sourceCode":"//go:build darwin || freebsd || linux || openbsd\n\npackage aghos\n\nimport (\n\t\"fmt\"\n\t\"os/user\"\n\t\"strconv\"\n\t\"syscall\"\n)\n\nfunc setGroup(groupName string) (err error) {\n\tg, err := user.LookupGroup(groupName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"looking up group: %w\", err)\n\t}\n\n\tgid, err := strconv.Atoi(g.Gid)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parsing gid: %w\", err)\n\t}\n\n\terr = syscall.Setgid(gid)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"setting gid: %w\", err)\n\t}\n\n\treturn nil\n}\n\nfunc setUser(userName string) (err error) {\n\tu, err := user.Lookup(userName)\n\tif err != nil {","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/aghos/user_unix.go#L1-L33","documentation":"setGroup resolves a group name to a gid via os/user.LookupGroup before calling syscall.Setgid; this error means the lookup itself failed — typically user.UnknownGroupError (no such group) or a backend failure reading group databases.","triggerScenarios":"Configuring AdGuardHome with a group: value in the config that doesn't exist on the host, or running in a container/image that lacks the group entry; also possible NSS/getent failures on the host, or CGO-disabled builds using pure-Go /etc/group parsing hitting malformed files.","commonSituations":"Typos in the group name in YAML config; Docker images missing the expected group; LDAP/NIS environments where the pure-Go lookup can't see remote groups.","solutions":["Verify the group exists: getent group <name> on the target host","Fix the typo or create the group, then restart","In containers, ensure the group is baked into the image or passed via docker --group-add","Check /etc/group for corruption if lookups fail for existing groups"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if _, err := user.LookupGroup(groupName); err != nil { /* fix config: group missing on this host */ }","typeGuard":"func isUnknownGroup(err error) bool { var e user.UnknownGroupError; return errors.As(err, &e) }","tryCatchPattern":"if err != nil {\n    var unknown user.UnknownGroupError\n    if errors.As(err, &unknown) { /* correct group name or create group */ }\n}","preventionTips":["Validate configured group names at startup with user.LookupGroup","Bake required groups into container images","Test config against the actual deployment host"],"tags":["unix","group","lookup","setgid","os-user"],"backgroundTag":"group-lookup-failed","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}