owasp-amass/amass · error

invalid type for default_transform_values

Error message

invalid type for default_transform_values

What it means

loadGlobalTransformSettings reads the optional 'default_transform_values' key from config Options and asserts it is a map[string]interface{}. Any other type triggers this error. It means the YAML value for default_transform_values is not a mapping (e.g. a string, list, or scalar).

Source

Thrown at config/transform.go:77

			transformation.TTL = c.DefaultTransformations.TTL
		}

		err := transformation.Validate(c)
		if err != nil {
			return err
		}
	}
	// If the loop completes with no conflicts, the function returns nil, indicating success.
	return nil
}

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")
		}

View on GitHub (pinned to 79299dce87)

Solutions

  1. Make default_transform_values a YAML mapping: 'default_transform_values:\n ttl: 60\n confidence: 80\n priority: 1'
  2. Check indentation so the child keys are nested under the key, not a string block
  3. If using yaml.v2 with non-string keys, convert or switch to yaml.v3 to get map[string]interface{}

Example fix

// before
default_transform_values: "ttl=60"
// after
default_transform_values:
  ttl: 60
Defensive patterns

Strategy: type-guard

Validate before calling

if dtv, ok := c.Options["default_transform_values"]; ok {
	if _, ok := dtv.(map[string]interface{}); !ok {
		return errors.New("default_transform_values must be a YAML mapping")
	}
}

Type guard

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

Try / catch

if err := cfg.LoadSettings(path); err != nil {
	if strings.Contains(err.Error(), "invalid type for default_transform_values") {
		return fmt.Errorf("fix default_transform_values in %s: must be a mapping", path)
	}
	return err
}

Prevention

When it happens

Trigger: Config YAML with 'default_transform_values: something' as a string, array, or scalar instead of a nested map with keys ttl/confidence/priority; YAML type coercion may also yield map[interface{}]interface{} which fails the assertion.

Common situations: Malformed YAML indentation collapsing the mapping, quoting the whole block into a string, or older YAML parsers (yaml.v2) delivering map[interface{}]interface{} instead of map[string]interface{}.

Related errors


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