{"record":{"id":"0ae1b7e21dd01fe1","repo":"owasp-amass/amass","slug":"resolvers-section-is-not-a-list","errorCode":null,"errorMessage":"resolvers section is not a list","messagePattern":"resolvers section is not a list","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/resolvers.go","lineNumber":173,"sourceCode":"}\n\n// CalcMaxQPS updates the MaxDNSQueries field of the configuration based on current settings.\nfunc (c *Config) CalcMaxQPS() {\n\tc.MaxDNSQueries = (len(c.Resolvers) * c.ResolversQPS) + (len(c.TrustedResolvers) * c.TrustedQPS)\n}\n\nfunc (c *Config) loadResolverSettings(cfg *Config) error {\n\t// Fetch resolvers from the Options map in the Config.\n\tresolversRaw, ok := c.Options[\"resolvers\"]\n\tif !ok {\n\t\t// \"resolvers\" not found in options, so nothing to do here.\n\t\treturn nil\n\t}\n\n\t// Type assert the raw resolvers to []interface{}\n\tresolvers, ok := resolversRaw.([]interface{})\n\tif !ok {\n\t\treturn errors.New(\"resolvers section is not a list\")\n\t}\n\n\tvar resolversList []string\n\tfor _, r := range resolvers {\n\t\t// Type assert the resolver to string\n\t\trStr, ok := r.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"resolver entry %v is not a string\", r)\n\t\t}\n\n\t\t// Check if rStr is an IP address.\n\t\tip := net.ParseIP(rStr)\n\t\tif ip != nil {\n\t\t\tresolversList = append(resolversList, rStr)\n\t\t\tcontinue\n\t\t}\n\n\t\t// rStr is not an IP address, so we assume it is a file path.","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/config/resolvers.go#L155-L191","documentation":"loadResolverSettings (config-file based loader) type-asserts the parsed resolvers value to []interface{}; this error is returned when the resolvers section exists but is not a list (e.g. a string, map, or scalar). The library expects resolvers to be supplied as a list of entries.","triggerScenarios":"Calling loadResolverSettings with a config where the resolvers key holds a single string (resolvers: 8.8.8.8), a mapping, or any non-list value, making the []interface{} assertion fail.","commonSituations":"Users write a single resolver as a scalar instead of a list item, indent the config incorrectly so the value parses as a string, or use a comma-separated string instead of a list.","solutions":["Rewrite the resolvers value as a list (one entry per line, e.g. '- 8.8.8.8').","Keep consistent indentation so each resolver is a separate list element.","Quote only individual addresses, not the whole list as one string.","Validate the config structure with a schema check before loading."],"exampleFix":"# before\nresolvers: 8.8.8.8\n# after\nresolvers:\n  - 8.8.8.8\n  - 1.1.1.1","handlingStrategy":"type-guard","validationCode":"raw := cfg[\"resolvers\"]\nif _, ok := raw.([]interface{}); !ok && raw != nil {\n    return errors.New(\"resolvers must be a list of strings\")\n}","typeGuard":"func isResolverList(v interface{}) bool {\n    list, ok := v.([]interface{})\n    if !ok || len(list) == 0 { return false }\n    for _, e := range list {\n        if _, ok := e.(string); !ok { return false }\n    }\n    return true\n}","tryCatchPattern":"if err := loadResolverSettings(cfg); err != nil {\n    if strings.Contains(err.Error(), \"not a list\") {\n        // rewrite resolvers as a list before retrying\n    }\n    return err\n}","preventionTips":["Always express resolvers as list items.","Add a config schema validation step.","Lint config file indentation in CI.","Provide example configs with a list-form resolvers block."],"tags":["config","type-mismatch","validation"],"backgroundTag":"config-type-mismatch","analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}