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 loading the INI file, LoadSettings uses go-ini's cfg.MapTo(c) to map settings onto the Config struct via field tags. If any value cannot be converted to the target field type (e.g. a non-integer string for an int field), MapTo fails and this error wraps the cause.
Source
Thrown at cmd/oam_i2y/ini.go:122
URL string `ini:"url"`
Username string `ini:"username"`
Password string `ini:"password"`
DBName string `ini:"database"`
Options string `ini:"options"`
}
// LoadSettings parses settings from an .ini file and assigns them to the Config.
func (c *Config) LoadSettings(path string) error {
cfg, err := ini.LoadSources(ini.LoadOptions{
Insensitive: true,
AllowShadows: true,
}, path)
if err != nil {
return fmt.Errorf("failed to load the configuration file: %v", err)
}
// Get the easy ones out of the way using mapping
if err = cfg.MapTo(c); err != nil {
return fmt.Errorf("error mapping configuration settings to internal values: %v", err)
}
// Attempt to load a special mode of operation specified by the user
if cfg.Section(ini.DefaultSection).HasKey("mode") {
mode := cfg.Section(ini.DefaultSection).Key("mode").String()
switch mode {
case "passive":
c.Passive = true
case "active":
c.Active = true
}
}
loads := []func(cfg *ini.File) error{
c.loadResolverSettings,
c.loadScopeSettings,
c.loadAlterationSettings,
c.loadBruteForceSettings,View on GitHub (pinned to 79299dce87)
Solutions
- Read the wrapped %v error — go-ini names the offending key/value — and correct that key's value type in the INI file.
- Make every value match the Config struct field types: integers unquoted, booleans true/false, no units or whitespace.
- Compare against a known-good example config shipped with the tool and fix diffs.
Example fix
// before (config.ini) port = 8080/tcp // after port = 8080
Defensive patterns
Strategy: validation
Validate before calling
// lint config values against expected types before LoadSettings
for _, kv := range numericKeys {
if _, err := strconv.Atoi(values[kv]); err != nil {
return fmt.Errorf("key %s must be an integer, got %q", kv, values[kv])
}
} Try / catch
if err := cfg.LoadSettings(path); err != nil {
if strings.Contains(err.Error(), "error mapping configuration settings") {
// wrapped go-ini error names the bad key/value; fix that line
return err
}
} Prevention
- Hand-edit numeric/boolean values without units, spaces, or locale formatting.
- Validate the config with the tool's example/template file after edits.
- Add a CI check that loads the config with LoadSettings before release.
When it happens
Trigger: An INI key whose value's type doesn't match the Config struct field (e.g. "port = abc" for an int field, "sensitive = maybe" for a bool), or a key mapped to an unsupported field type.
Common situations: Hand-edited config files with typos in numeric/boolean values; copy-pasting values with units ("30s", "8080/tcp"); locale-formatted numbers; schema drift after upgrading where keys changed meaning.
Related errors
- failed to load the configuration file: %v
- no resolver keys were found in the resolvers section
- resolvers section is not a list
- target must be a FQDN or IPAddress
- failed to parse active setting, value is not a boolean
AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06).
Data as JSON: /api/errors/0aff0a7c02022608.
Report an issue: GitHub.