{"record":{"id":"6707c29e84de83d0","repo":"owasp-amass/amass","slug":"invalid-ip-address-in-resolvers-file-s","errorCode":null,"errorMessage":"invalid IP address in resolvers file: %s","messagePattern":"invalid IP address in resolvers file: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/resolvers.go","lineNumber":243,"sourceCode":"\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open resolvers file: %w\", err)\n\t}\n\n\t// Split the file data by newlines to get the IP addresses.\n\tlines := strings.Split(string(data), \"\\n\")\n\n\tvar resolvers []string\n\tfor _, line := range lines {\n\t\tline = strings.TrimSpace(line)\n\t\t// Skip empty lines.\n\t\tif line == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check if each line in the file is a valid IP address.\n\t\tip := net.ParseIP(line)\n\t\tif ip == nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid IP address in resolvers file: %s\", line)\n\t\t}\n\n\t\tresolvers = append(resolvers, line)\n\t}\n\n\treturn resolvers, nil\n}\n","sourceCodeStart":225,"sourceCodeEnd":251,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/config/resolvers.go#L225-L251","documentation":"After reading the resolvers file, each non-empty line must parse as an IP address via net.ParseIP. This error is returned when a line is not a valid IPv4/IPv6 literal, aborting the whole load. The offending line is included in the message.","triggerScenarios":"A line in the resolvers file contains a hostname, a comment, CIDR notation (e.g. 10.0.0.0/8), trailing whitespace artifacts, or any malformed text that net.ParseIP rejects.","commonSituations":"Users paste DNS server hostnames (8.8.8.8 works, dns.google does not) or include # comment lines, empty lines with stray characters, or IPv6 entries with zone indices.","solutions":["Open the resolvers file and fix or remove the line reported in the error","Replace hostnames with literal IP addresses (net.ParseIP does not resolve names)","Remove CIDR ranges and comments; only bare IPv4/IPv6 literals are accepted","Strip trailing whitespace/CR (Windows line endings) from lines if IPs look correct"],"exampleFix":"// before (resolvers.txt)\ndns.google\n# public dns\n// after (resolvers.txt)\n8.8.8.8\n1.1.1.1","handlingStrategy":"validation","validationCode":"for _, l := range lines(strings.TrimSpace) { if l != \"\" && net.ParseIP(l) == nil { return fmt.Errorf(\"bad resolver line: %q\", l) } }","typeGuard":"func isIPLine(s string) bool { return net.ParseIP(strings.TrimSpace(s)) != nil }","tryCatchPattern":null,"preventionTips":["Only put literal IPv4/IPv6 addresses in the file, one per line","No comments, CIDR, or hostnames in resolvers files","Sanitize Windows CRLF line endings","Validate the file with a lint script before use"],"tags":["config","validation","ip-address"],"backgroundTag":"invalid-config-value","analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}