{"record":{"id":"3e056668be3c5922","repo":"AdguardTeam/AdGuardHome","slug":"config-line-at-idx-d-w","errorCode":null,"errorMessage":"config line at idx %d: %w","messagePattern":"config line at idx (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/ipset/ipset_linux.go","lineNumber":281,"sourceCode":"\t// only the IPv4 one.\n\t//\n\t// TODO(a.garipov): Find out if this is a bug or a feature.\n\tall, err := m.ipv4Conn.listAll()\n\tif err != nil {\n\t\t// Don't wrap the error since it's informative enough as is.\n\t\treturn err\n\t}\n\n\tcurrentlyKnown := map[string]props{}\n\tfor _, p := range all {\n\t\tcurrentlyKnown[p.name] = p\n\t}\n\n\tfor i, confStr := range ipsetConf {\n\t\tvar hosts, ipsetNames []string\n\t\thosts, ipsetNames, err = parseIpsetConfigLine(confStr)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"config line at idx %d: %w\", i, err)\n\t\t}\n\n\t\tvar ipsets []props\n\t\tipsets, err = m.ipsets(ctx, ipsetNames, currentlyKnown)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"getting ipsets from config line at idx %d: %w\", i, err)\n\t\t}\n\n\t\tfor _, host := range hosts {\n\t\t\tm.domainToIpsets[host] = append(m.domainToIpsets[host], ipsets...)\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// ipsetProps returns the properties of an ipset with the given name.\n//","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/ipset/ipset_linux.go#L263-L299","documentation":"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.","triggerScenarios":"Any parseIpsetConfigLine error on ipsetConf[i] during newManagerWithDialer; the message includes 'config line at idx N'.","commonSituations":"Long ipset config lists where locating the bad line manually is tedious; error message pinpoints the index.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil {\n\tvar idx int\n\tif _, e := fmt.Sscanf(err.Error(), \"config line at idx %d\", &idx); e == nil {\n\t\tlog.Printf(\"bad ipset config entry %d: %v\", idx, errors.Unwrap(err))\n\t}\n}","preventionTips":["Use the idx in the message to map straight to the offending YAML entry","Keep ipset lines short and commented for easy diagnosis"],"tags":["ipset","config","wrapping"],"backgroundTag":"config-format-invalid","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}