owasp-amass/amass · error

bruteforce is not a map[string]interface{}

Error message

bruteforce is not a map[string]interface{}

What it means

Config.loadBruteForceSettings retrieves the "bruteforce" key from the options map and asserts it is a map[string]interface{} before reading sub-settings like enabled and wordlists. The assertion failed, meaning "bruteforce" holds a scalar, array, or other non-map value. The library throws this because the bruteforce section cannot be structured as expected.

Source

Thrown at config/brute.go:21

// SPDX-License-Identifier: Apache-2.0

package config

import (
	"fmt"

	"github.com/caffix/stringset"
)

func (c *Config) loadBruteForceSettings(cfg *Config) error {
	bruteforceRaw, ok := c.Options["bruteforce"]
	if !ok {
		return nil
	}

	bruteforce, ok := bruteforceRaw.(map[string]interface{})
	if !ok {
		return fmt.Errorf("bruteforce is not a map[string]interface{}")
	}

	enabled, ok := bruteforce["enabled"].(bool)
	if !ok {
		return fmt.Errorf("bruteforce enabled is not a bool")
	}

	c.BruteForcing = enabled
	if !c.BruteForcing {
		return nil
	}

	if wordlistPathRaw, ok := bruteforce["wordlists"]; ok {
		wordlistPaths, ok := wordlistPathRaw.([]interface{})
		if !ok {
			return fmt.Errorf("bruteforce wordlist_file is not an array")
		}

View on GitHub (pinned to 79299dce87)

Solutions

  1. Make the bruteforce key a mapping in the config: bruteforce:\n enabled: true
  2. Check indentation in YAML so bruteforce is a nested block, not a scalar
  3. If setting Options in Go code, use map[string]interface{}{"enabled": true, ...}
  4. Remove the "bruteforce" key if brute-forcing is not needed (absence is tolerated)

Example fix

# before
bruteforce: true

# after
bruteforce:
  enabled: true
Defensive patterns

Strategy: type-guard

Validate before calling

func validateBruteForceSection(options map[string]interface{}) error {
	v, ok := options["bruteforce"]
	if !ok {
		return nil
	}
	if _, ok := v.(map[string]interface{}); !ok {
		return fmt.Errorf("bruteforce must be a mapping, got %T", v)
	}
	return nil
}

Type guard

func isStringMap(v interface{}) bool { _, ok := v.(map[string]interface{}); return ok }

Try / catch

if err := cfg.LoadSettings(); err != nil {
	if strings.Contains(err.Error(), "bruteforce is not a map") {
		// reload or fix the bruteforce section in the config
	}
	log.Fatal(err)
}

Prevention

When it happens

Trigger: Loading a config where c.Options["bruteforce"] exists but is not a map, e.g. bruteforce: true, bruteforce: "on", or a list in the parsed options.

Common situations: Config file where the bruteforce section was flattened into a scalar; YAML indentation mistake collapsing a map into a string; programmatic config construction passing a struct or string instead of map[string]interface{}.

Related errors


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