owasp-amass/amass · error

error mapping configuration settings to internal values: %v

Error message

error mapping configuration settings to internal values: %v

What it means

After reading the file, LoadSettings unmarshals the YAML into the Config struct with yaml.Unmarshal. If the document is not valid YAML or contains fields incompatible with the struct, it returns 'error mapping configuration settings to internal values'. Env-based database/engine settings are still applied before returning.

Source

Thrown at config/config.go:280

		_ = c.LoadDatabaseEnvSettings()
		_ = c.LoadEngineEnvSettings()
		return fmt.Errorf("failed to get absolute path of the configuration file: %v", err)
	}
	c.Filepath = absolutePath

	// Open the configuration file
	data, err := os.ReadFile(c.Filepath)
	if err != nil {
		_ = c.LoadDatabaseEnvSettings()
		_ = c.LoadEngineEnvSettings()
		return fmt.Errorf("failed to load the main configuration file: %v", err)
	}

	err = yaml.Unmarshal(data, c)
	if err != nil {
		_ = c.LoadDatabaseEnvSettings()
		_ = c.LoadEngineEnvSettings()
		return fmt.Errorf("error mapping configuration settings to internal values: %v", err)
	}

	if err := c.loadSeedandScopeSettings(); err != nil {
		return err
	}

	loads := []func(cfg *Config) error{
		c.loadAlterationSettings,
		c.loadBruteForceSettings,
		c.loadDatabaseSettings,
		c.loadDataSourceSettings,
		c.loadResolverSettings,
		c.loadTransformSettings,
		c.loadEngineSettings,
		c.loadActiveSettings,
		c.loadRigidSettings,
	}
	for _, load := range loads {

View on GitHub (pinned to 79299dce87)

Solutions

  1. Validate the file with a YAML linter: `yamllint config.yaml` or an online parser, and fix the reported line.
  2. Replace tab characters with spaces — tabs are illegal YAML indentation.
  3. Check that each key's value type matches the expected structure (maps vs lists vs scalars).
  4. Bisect by loading the file with a minimal yaml.Unmarshal in a scratch program to get the precise parser error.

Example fix

// before (config.yaml)
scopes:
	- example.com  # tab indentation
// after
scopes:
  - example.com
Defensive patterns

Strategy: validation

Validate before calling

raw, err := os.ReadFile(cfgPath)
if err != nil { return err }
var probe map[string]any
if err := yaml.Unmarshal(raw, &probe); err != nil {
    return fmt.Errorf("config YAML invalid: %w", err)
}

Try / catch

if err := cfg.LoadSettings(path); err != nil {
    if strings.Contains(err.Error(), "error mapping configuration settings to internal values") {
        // run the raw YAML through yaml.Unmarshal directly to get the exact line/column
    }
    return err
}

Prevention

When it happens

Trigger: LoadSettings called with a config file containing invalid YAML syntax (bad indentation, tabs, unclosed quotes), duplicate keys rejected by the parser, or a scalar where the struct expects a map/list.

Common situations: Hand-edited YAML with mixed tabs/spaces; generated config where interpolation produced invalid YAML; pasting JSON-style content with unquoted values; upgrading between versions where a field's type changed.

Related errors


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