owasp-amass/amass · error

invalid type for priority in default_transform_values

Error message

invalid type for priority in default_transform_values

What it means

The 'confidence' field inside default_transform_values is present and non-nil but is not an int (e.g. a quoted string "80" or a float from YAML). The type assertion dtvMap["confidence"].(int) fails and the guard rejects the config, since confidence must be an integer value for Transformation settings.

Source

Thrown at config/transform.go:93

		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 split
	}
	// Split the key into 'From' and 'To' components, expecting a "->" delimiter.
	parts := strings.Split(key, "->")
	if len(parts) != 2 {
		return fmt.Errorf("invalid key delimiter: %s", key)

View on GitHub (pinned to 79299dce87)

Solutions

  1. Set priority as an unquoted integer, e.g. priority: 1
  2. Replace named levels with their integer equivalents
  3. Run the config through a YAML validator to confirm int typing

Example fix

// before
default_transform_values:
  priority: "1"
// after
default_transform_values:
  priority: 1
Defensive patterns

Strategy: type-guard

Validate before calling

if v, ok := dtv["priority"]; ok && v != nil {
	if _, isInt := v.(int); !isInt {
		return errors.New("priority 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 priority") {
	return fmt.Errorf("priority must be an integer in %s", path)
}

Prevention

When it happens

Trigger: YAML like 'priority: "1"' or 'priority: high' inside default_transform_values — quoted numbers or words fail the .(int) assertion.

Common situations: Quoting numbers in hand-edited YAML, or using named priority levels ('high'/'low') unsupported by the parser.

Related errors


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