AdguardTeam/AdGuardHome · error

looking up group: %w

Error message

looking up group: %w

What it means

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.

Source

Thrown at internal/aghos/user_unix.go:15

//go:build darwin || freebsd || linux || openbsd

package aghos

import (
	"fmt"
	"os/user"
	"strconv"
	"syscall"
)

func setGroup(groupName string) (err error) {
	g, err := user.LookupGroup(groupName)
	if err != nil {
		return fmt.Errorf("looking up group: %w", err)
	}

	gid, err := strconv.Atoi(g.Gid)
	if err != nil {
		return fmt.Errorf("parsing gid: %w", err)
	}

	err = syscall.Setgid(gid)
	if err != nil {
		return fmt.Errorf("setting gid: %w", err)
	}

	return nil
}

func setUser(userName string) (err error) {
	u, err := user.Lookup(userName)
	if err != nil {

View on GitHub (pinned to b41aefbe51)

Solutions

  1. Verify the group exists: getent group <name> on the target host
  2. Fix the typo or create the group, then restart
  3. In containers, ensure the group is baked into the image or passed via docker --group-add
  4. Check /etc/group for corruption if lookups fail for existing groups
Defensive patterns

Strategy: validation

Validate before calling

if _, err := user.LookupGroup(groupName); err != nil { /* fix config: group missing on this host */ }

Type guard

func isUnknownGroup(err error) bool { var e user.UnknownGroupError; return errors.As(err, &e) }

Try / catch

if err != nil {
    var unknown user.UnknownGroupError
    if errors.As(err, &unknown) { /* correct group name or create group */ }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27). Data as JSON: /api/errors/2a4e02fc39b8627a. Report an issue: GitHub.