AdguardTeam/AdGuardHome · warning
%s: not supported on %s: %w
Error message
%s: not supported on %s: %w
What it means
Returned by aghos.Unsupported, this error signals that the requested operation has no implementation on the current platform (runtime.GOOS). It wraps Go 1.21's errors.ErrUnsupported so callers can detect it with errors.Is(err, errors.ErrUnsupported). It is used for OS-specific features like DHCP interface operations, setting rlimits, and changing uid/gid.
Source
Thrown at internal/aghos/os.go:34
"runtime"
"slices"
"strconv"
"strings"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/osutil/executil"
)
// Default file, binary, and directory permissions.
const (
DefaultPermDir fs.FileMode = 0o700
DefaultPermExe fs.FileMode = 0o700
DefaultPermFile fs.FileMode = 0o600
)
// Unsupported is a helper that returns a wrapped [errors.ErrUnsupported].
func Unsupported(op string) (err error) {
return fmt.Errorf("%s: not supported on %s: %w", op, runtime.GOOS, errors.ErrUnsupported)
}
// SetRlimit sets user-specified limit of how many fd's we can use.
//
// See https://github.com/AdguardTeam/AdGuardHome/internal/issues/659.
func SetRlimit(val uint64) (err error) {
return setRlimit(val)
}
// HaveAdminRights checks if the current user has root (administrator) rights.
func HaveAdminRights() (bool, error) {
return haveAdminRights()
}
// MaxCmdOutputSize is the maximum length of performed shell command output in
// bytes.
const MaxCmdOutputSize = 64 * 1024
View on GitHub (pinned to b41aefbe51)
Solutions
- Check the value of runtime.GOOS before invoking the platform-specific helper, or gate the call in build-tagged files
- Detect it programmatically: if errors.Is(err, errors.ErrUnsupported) { skip or degrade gracefully }
- If the feature is required, run on a platform where the operation is implemented (typically Linux/BSD)
Example fix
// before
err := aghos.SetRlimit(65536)
if err != nil { log.Fatal(err) }
// after
err := aghos.SetRlimit(65536)
if errors.Is(err, errors.ErrUnsupported) {
log.Warn("rlimit not supported on this OS; skipping")
} else if err != nil {
log.Fatal(err)
} Defensive patterns
Strategy: type-guard
Validate before calling
if runtime.GOOS == "windows" { /* skip rlimit/uid-gid features */ } Type guard
func isUnsupported(err error) bool { return errors.Is(err, errors.ErrUnsupported) } Try / catch
err := op()
if err != nil {
if errors.Is(err, errors.ErrUnsupported) { /* degrade gracefully */ return nil }
return err
} Prevention
- Gate platform-specific calls behind runtime.GOOS checks or build tags
- Always test with errors.Is(err, errors.ErrUnsupported) instead of string matching
- Run feature CI on all target platforms
When it happens
Trigger: Calling checkOtherDHCP, ifaceSetStaticIP, ifaceHasStaticIP, SetRlimit, setGroup, or setUser on a platform where those functions are stubbed out with a call to Unsupported (e.g. setGroup/setUser and rlimit tweaks on Windows, or static-IP interface ops on non-supported Unix variants).
Common situations: Building or running AdGuardHome's internal helpers on Windows or an exotic GOOS where syscall-level operations (Setgid, Setuid, RLIMIT, netlink interface manipulation) don't exist; CI matrix builds compiling platform-specific files.
Related errors
- duplicated values: %v
- unmarshalling json data into aghalg.NullBool: bad value %q
- json duration is nil
- parsing json time: %w
- json time is nil
AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27).
Data as JSON: /api/errors/75c4751f07bce1cb.
Report an issue: GitHub.