owasp-amass/amass · error
invalid type for confidence in default_transform_values
Error message
invalid type for confidence in default_transform_values
What it means
loadGlobalTransformSettings found a 'default_transform_values' option in the config, but it is not a map[string]interface{} — the type assertion fails (typically the YAML value is a scalar or a list). This is a shape guard on the config entry; the offending input is the default_transform_values value itself, before any per-field (ttl/confidence) extraction happens.
Source
Thrown at config/transform.go:88
func (c *Config) loadGlobalTransformSettings() error {
// get the default_transfom_values in the config yaml
if dtv, ok := c.Options["default_transform_values"]; ok {
// Assert the type to map[interface{}]interface{}
dtvMap, ok := dtv.(map[string]interface{})
if !ok {
return fmt.Errorf("invalid type for default_transform_values")
}
// Convert the map to the Transformation struct
if ttl, ok := dtvMap["ttl"].(int); ok {
c.DefaultTransformations.TTL = ttl
} else if !ok && dtvMap["ttl"] != nil {
return fmt.Errorf("invalid type for ttl in default_transform_values")
}
if confidence, ok := dtvMap["confidence"].(int); ok {
c.DefaultTransformations.Confidence = confidence
} else if !ok && dtvMap["confidence"] != nil {
return fmt.Errorf("invalid type for confidence in default_transform_values")
}
if priority, ok := dtvMap["priority"].(int); ok {
c.DefaultTransformations.Priority = priority
} else if !ok && dtvMap["priority"] != nil {
return fmt.Errorf("invalid type for priority in default_transform_values")
}
}
return nil
}
// Split splits the key into 'From' and 'To' components, expecting a "->" delimiter.
// Requires a non-nil Transformation pointer and a valid key format. Example: FQDN->IPaddress.
func (t *Transformation) Split(key string) error {
if t.From != "" && t.To != "" {
t.From = strings.ToLower(t.From)
t.To = strings.ToLower(t.To)
return nil // Already splitView on GitHub (pinned to 79299dce87)
Solutions
- Use an integer confidence value (e.g. confidence: 80) matching the library's scale
- Convert 0.8-style decimals to integers (80) before writing the config
- Quote nothing: keep it an unquoted YAML integer
Example fix
// before default_transform_values: confidence: 0.8 // after default_transform_values: confidence: 80
Defensive patterns
Strategy: type-guard
Validate before calling
if v, ok := dtv["confidence"]; ok && v != nil {
if _, isInt := v.(int); !isInt {
return errors.New("confidence in default_transform_values must be an integer")
}
} Type guard
func isInt(v interface{}) bool { _, ok := v.(int); return ok } Try / catch
if err := cfg.LoadSettings(path); err != nil && strings.Contains(err.Error(), "invalid type for confidence") {
return fmt.Errorf("confidence must be an integer in %s", path)
} Prevention
- Use the library's integer confidence scale, not decimals or words
- Keep the value unquoted in YAML
- Document valid confidence ranges in your config template
When it happens
Trigger: YAML like 'confidence: "high"' or 'confidence: 0.8' inside default_transform_values — strings or floats fail the .(int) assertion.
Common situations: Expressing confidence as a decimal 0-1 or a descriptive word instead of the integer scale the library expects.
Related errors
- invalid type for default_transform_values
- invalid type for ttl in default_transform_values
- invalid type for priority in default_transform_values
- error when splitting the key: %w
- alterations wordlist_file item is not a string
AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06).
Data as JSON: /api/errors/6e949830df750768.
Report an issue: GitHub.