owasp-amass/amass · error

resolver entry %v is not a string

Error message

resolver entry %v is not a string

What it means

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.

Source

Thrown at config/resolvers.go:181

	// 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.
		absPath, err := c.AbsPathFromConfigDir(rStr)
		if err != nil {
			return fmt.Errorf("failed to get absolute path for resolver file: %w", err)
		}

		fileResolvers, err := c.loadResolversFromFile(absPath)
		if err != nil {
			return fmt.Errorf("failed to load resolvers from file: %w", err)

View on GitHub (pinned to 79299dce87)

Solutions

  1. Quote every resolver entry in the config: - "8.8.8.8" instead of - 8.8.8.8.
  2. Inspect the resolver list in the config for non-string entries (numbers, booleans, nested objects) at the reported value %v.
  3. Re-download/replace the default config file to eliminate corruption.

Example fix

// before (YAML)
resolvers:
  - 8.8.8.8
  - yes
// after
resolvers:
  - "8.8.8.8"
  - "yes"
Defensive patterns

Strategy: type-guard

Validate before calling

for _, r := range resolvers {
    if _, ok := r.(string); !ok {
        return fmt.Errorf("resolver entries must be strings, got %T", r)
    }
}

Type guard

func isStringResolver(r any) bool { _, ok := r.(string); return ok }

Try / catch

if err := loadResolverSettings(); err != nil {
    if strings.Contains(err.Error(), "is not a string") {
        return fmt.Errorf("quote resolver entries in config: %w", err)
    }
}

Prevention

When it happens

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

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

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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