owasp-amass/amass · error

resolvers section is not a list

Error message

resolvers section is not a list

What it means

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.

Source

Thrown at config/resolvers.go:173

}

// CalcMaxQPS updates the MaxDNSQueries field of the configuration based on current settings.
func (c *Config) CalcMaxQPS() {
	c.MaxDNSQueries = (len(c.Resolvers) * c.ResolversQPS) + (len(c.TrustedResolvers) * c.TrustedQPS)
}

func (c *Config) loadResolverSettings(cfg *Config) error {
	// Fetch resolvers from the Options map in the Config.
	resolversRaw, ok := c.Options["resolvers"]
	if !ok {
		// "resolvers" not found in options, so nothing to do here.
		return nil
	}

	// Type assert the raw resolvers to []interface{}
	resolvers, ok := resolversRaw.([]interface{})
	if !ok {
		return errors.New("resolvers section is not a list")
	}

	var resolversList []string
	for _, r := range resolvers {
		// Type assert the resolver to string
		rStr, ok := r.(string)
		if !ok {
			return fmt.Errorf("resolver entry %v is not a string", r)
		}

		// Check if rStr is an IP address.
		ip := net.ParseIP(rStr)
		if ip != nil {
			resolversList = append(resolversList, rStr)
			continue
		}

		// rStr is not an IP address, so we assume it is a file path.

View on GitHub (pinned to 79299dce87)

Solutions

  1. Rewrite the resolvers value as a list (one entry per line, e.g. '- 8.8.8.8').
  2. Keep consistent indentation so each resolver is a separate list element.
  3. Quote only individual addresses, not the whole list as one string.
  4. Validate the config structure with a schema check before loading.

Example fix

# before
resolvers: 8.8.8.8
# after
resolvers:
  - 8.8.8.8
  - 1.1.1.1
Defensive patterns

Strategy: type-guard

Validate before calling

raw := cfg["resolvers"]
if _, ok := raw.([]interface{}); !ok && raw != nil {
    return errors.New("resolvers must be a list of strings")
}

Type guard

func isResolverList(v interface{}) bool {
    list, ok := v.([]interface{})
    if !ok || len(list) == 0 { return false }
    for _, e := range list {
        if _, ok := e.(string); !ok { return false }
    }
    return true
}

Try / catch

if err := loadResolverSettings(cfg); err != nil {
    if strings.Contains(err.Error(), "not a list") {
        // rewrite resolvers as a list before retrying
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06). Data as JSON: /api/errors/0ae1b7e21dd01fe1. Report an issue: GitHub.