{"record":{"id":"63cb3ad692551c8e","repo":"owasp-amass/amass","slug":"resolver-entry-v-is-not-a-string","errorCode":null,"errorMessage":"resolver entry %v is not a string","messagePattern":"resolver entry (.+?) is not a string","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/resolvers.go","lineNumber":181,"sourceCode":"\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.\n\t\tabsPath, err := c.AbsPathFromConfigDir(rStr)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get absolute path for resolver file: %w\", err)\n\t\t}\n\n\t\tfileResolvers, err := c.loadResolversFromFile(absPath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to load resolvers from file: %w\", err)","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/config/resolvers.go#L163-L199","documentation":"loadResolverSettings reads the resolver list from the configuration, expecting each entry to be a plain string. If an entry in the parsed config is any other type (number, bool, nested map), the type assertion r.(string) fails and this error names the offending value.","triggerScenarios":"A YAML/JSON config where an IP resolver entry is unquoted so YAML parses it as something else (e.g. a float like 1.1.1.1 stays fine but 8.8e0 style or bool-like tokens such as 'yes'/'on' become non-strings), or an entry accidentally nested as an object.","commonSituations":"YAML type coercion turning unquoted values into numbers/booleans (e.g. `on`, `no`, `1.2.3` variants); JSON config with numeric IPs; hand-edited configs with stray nested maps.","solutions":["Quote every resolver entry in the config: - \"8.8.8.8\" instead of - 8.8.8.8.","Inspect the resolver list in the config for non-string entries (numbers, booleans, nested objects) at the reported value %v.","Re-download/replace the default config file to eliminate corruption."],"exampleFix":"// before (YAML)\nresolvers:\n  - 8.8.8.8\n  - yes\n// after\nresolvers:\n  - \"8.8.8.8\"\n  - \"yes\"","handlingStrategy":"type-guard","validationCode":"for _, r := range resolvers {\n    if _, ok := r.(string); !ok {\n        return fmt.Errorf(\"resolver entries must be strings, got %T\", r)\n    }\n}","typeGuard":"func isStringResolver(r any) bool { _, ok := r.(string); return ok }","tryCatchPattern":"if err := loadResolverSettings(); err != nil {\n    if strings.Contains(err.Error(), \"is not a string\") {\n        return fmt.Errorf(\"quote resolver entries in config: %w\", err)\n    }\n}","preventionTips":["Quote all resolver entries in YAML/JSON configs","Beware YAML auto-typing of tokens like yes/no/on/off","Validate config with a schema before loading"],"tags":["configuration","type-mismatch","validation"],"backgroundTag":"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"}