AdguardTeam/AdGuardHome · error
config line at idx %d: %w
Error message
config line at idx %d: %w
What it means
Wraps a per-line parse failure with the index of the offending line in the ipset config. The inner error (382/383) explains the actual problem; this adds position context.
Source
Thrown at internal/ipset/ipset_linux.go:281
// only the IPv4 one.
//
// TODO(a.garipov): Find out if this is a bug or a feature.
all, err := m.ipv4Conn.listAll()
if err != nil {
// Don't wrap the error since it's informative enough as is.
return err
}
currentlyKnown := map[string]props{}
for _, p := range all {
currentlyKnown[p.name] = p
}
for i, confStr := range ipsetConf {
var hosts, ipsetNames []string
hosts, ipsetNames, err = parseIpsetConfigLine(confStr)
if err != nil {
return fmt.Errorf("config line at idx %d: %w", i, err)
}
var ipsets []props
ipsets, err = m.ipsets(ctx, ipsetNames, currentlyKnown)
if err != nil {
return fmt.Errorf("getting ipsets from config line at idx %d: %w", i, err)
}
for _, host := range hosts {
m.domainToIpsets[host] = append(m.domainToIpsets[host], ipsets...)
}
}
return nil
}
// ipsetProps returns the properties of an ipset with the given name.
//View on GitHub (pinned to b41aefbe51)
Solutions
- Look at the inner error and the Nth (0-based) entry of the ipset config lines array
- Fix that line's host/name format or empty name
- Restart/reload the service
Defensive patterns
Strategy: try-catch
Try / catch
if err != nil {
var idx int
if _, e := fmt.Sscanf(err.Error(), "config line at idx %d", &idx); e == nil {
log.Printf("bad ipset config entry %d: %v", idx, errors.Unwrap(err))
}
} Prevention
- Use the idx in the message to map straight to the offending YAML entry
- Keep ipset lines short and commented for easy diagnosis
When it happens
Trigger: Any parseIpsetConfigLine error on ipsetConf[i] during newManagerWithDialer; the message includes 'config line at idx N'.
Common situations: Long ipset config lists where locating the bad line manually is tedious; error message pinpoints the index.
Related errors
- invalid value %q: expected one slash
- invalid value %q: empty ipset name
- getting ipsets from config line at idx %d: %w
- unknown ipset %q
- getting ipsets: %w
AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27).
Data as JSON: /api/errors/3e056668be3c5922.
Report an issue: GitHub.