AdguardTeam/AdGuardHome · error
invalid value %q: empty ipset name
Error message
invalid value %q: empty ipset name
What it means
The ipset-name side of a config line contained an empty element after trimming, e.g. 'host/' or 'host/a,,b'. Hosts may be empty but ipset names may not.
Source
Thrown at internal/ipset/ipset_linux.go:248
// parseIpsetConfigLine parses one ipset configuration line.
func parseIpsetConfigLine(confStr string) (hosts, ipsetNames []string, err error) {
confStr = strings.TrimSpace(confStr)
hostsAndNames := strings.Split(confStr, "/")
if len(hostsAndNames) != 2 {
return nil, nil, fmt.Errorf("invalid value %q: expected one slash", confStr)
}
hosts = strings.Split(hostsAndNames[0], ",")
ipsetNames = strings.Split(hostsAndNames[1], ",")
if len(ipsetNames) == 0 {
return nil, nil, nil
}
for i := range ipsetNames {
ipsetNames[i] = strings.TrimSpace(ipsetNames[i])
if len(ipsetNames[i]) == 0 {
return nil, nil, fmt.Errorf("invalid value %q: empty ipset name", confStr)
}
}
for i := range hosts {
hosts[i] = strings.ToLower(strings.TrimSpace(hosts[i]))
}
return hosts, ipsetNames, nil
}
// parseIpsetConfig parses the ipset configuration and stores ipsets. It
// returns an error if the configuration can't be used.
func (m *manager) parseIpsetConfig(ctx context.Context, ipsetConf []string) (err error) {
// The family doesn't seem to matter when we use a header query, so query
// only the IPv4 one.
//
// TODO(a.garipov): Find out if this is a bug or a feature.
all, err := m.ipv4Conn.listAll()View on GitHub (pinned to b41aefbe51)
Solutions
- Ensure every comma-separated ipset name is non-empty
- Remove trailing commas/slashes from the line
- Validate config lines in CI before deployment
Example fix
# before - example.org/ # after - example.org/myset
Defensive patterns
Strategy: validation
Validate before calling
func ipsetNamesNonEmpty(line string) bool {
parts := strings.SplitN(line, "/", 2)
if len(parts) != 2 { return false }
for _, n := range strings.Split(parts[1], ",") {
if strings.TrimSpace(n) == "" { return false }
}
return true
} Prevention
- Reject lines with trailing commas or slashes at config load time
- Lint generated ipset config
When it happens
Trigger: parseIpsetConfigLine splits the right side on commas and finds an empty name: trailing slash, double comma, or whitespace-only name.
Common situations: Copy-paste config with a trailing comma, template-generated lines leaving an empty name, or a line of just '/' after trimming.
Related errors
- invalid value %q: expected one slash
- networksetup failed to set dns servers: %w
- found no dns servers in %s
- writing conf: %w
- invalid pattern %q: %w
AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27).
Data as JSON: /api/errors/5b46699f9d87ca62.
Report an issue: GitHub.