{"record":{"id":"bc7afd1d6528a69f","repo":"AdguardTeam/AdGuardHome","slug":"getting-ipsets-from-config-line-at-idx-d-w","errorCode":null,"errorMessage":"getting ipsets from config line at idx %d: %w","messagePattern":"getting ipsets from config line at idx (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/ipset/ipset_linux.go","lineNumber":287,"sourceCode":"\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//\n// Additional header data query.  See https://github.com/AdguardTeam/AdGuardHome/issues/6420.\n//\n// TODO(s.chzhen):  Use *props.\nfunc (m *manager) ipsetProps(name string) (p props, err error) {\n\t// The family doesn't seem to matter when we use a header query, so\n\t// query only the IPv4 one.","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/ipset/ipset_linux.go#L269-L305","documentation":"While parsing config line i, resolving the referenced ipset names against the ipsets known on the system failed — typically one of the names does not exist (see 'unknown ipset %q') or a header query failed.","triggerScenarios":"A config line references an ipset that was not returned by the initial list of sets and not created afterwards, so m.ipsets cannot find properties for it.","commonSituations":"Referencing an ipset before creating it with 'ipset create', a typo in the set name, or sets lost after reboot (not persisted).","solutions":["Run 'ipset list' and verify each name in the config exists","Create missing sets with 'ipset create <name> hash:ip family inet' or similar","Persist ipsets across reboots (ipset save/restore, netfilter-persistent)"],"exampleFix":"# before\nipset list | grep blocklist   # missing\n# after\nipset create blocklist hash:ip family inet\nipset save > /etc/ipset.conf","handlingStrategy":"validation","validationCode":"func requiredSetsExist(conf []string) error {\n\tknown := shellOut(\"ipset\", \"list\", \"-name\")\n\tfor _, line := range conf {\n\t\tfor _, n := range strings.Split(strings.SplitN(line, \"/\", 2)[1], \",\") {\n\t\t\tif !known[strings.TrimSpace(n)] { return fmt.Errorf(\"missing set %q\", n) }\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-create all referenced ipsets in the same provisioning script that writes config","Persist sets via ipset save/restore on boot"],"tags":["ipset","config","lookup"],"backgroundTag":"resource-not-found","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}