owasp-amass/amass · error

invalid asset type

Error message

invalid asset type

What it means

defaultContentFilter maps each supported oam.Asset type to its database content filter key. When the asset's concrete type does not match any known case (e.g. falls through the switch), the function returns this error, so the asset cannot be stored with a content filter.

Source

Thrown at engine/api/server/v1/utils.go:269

	case oam.Organization:
		return dbt.ContentFilters{"unique_id": asset.Key()}, nil
	case oam.Person:
		return dbt.ContentFilters{"unique_id": asset.Key()}, nil
	case oam.Phone:
		return dbt.ContentFilters{"e164": asset.Key()}, nil
	case oam.Product:
		return dbt.ContentFilters{"unique_id": asset.Key()}, nil
	case oam.ProductRelease:
		return dbt.ContentFilters{"name": asset.Key()}, nil
	case oam.Service:
		return dbt.ContentFilters{"unique_id": asset.Key()}, nil
	case oam.TLSCertificate:
		return dbt.ContentFilters{"serial_number": asset.Key()}, nil
	case oam.URL:
		return dbt.ContentFilters{"url": asset.Key()}, nil
	}

	return nil, errors.New("invalid asset type")
}

View on GitHub (pinned to 79299dce87)

Solutions

  1. Identify the asset type being passed and add a case for it in defaultContentFilter with the correct content filter key
  2. Upgrade to a version where the asset type is supported
  3. Filter out unsupported asset types in the plugin before submitting via PutAsset

Example fix

// before
return nil, errors.New("invalid asset type")
// after
case oam.NewIPAddress(net.IPv4zero): // add the missing case
    return dbt.ContentFilters{"address": asset.Key()}, nil
Defensive patterns

Strategy: validation

Validate before calling

switch a.(type) {
case *oam.TLSCertificate, *oam.URL: // supported types
default:
    return fmt.Errorf("asset type %T not supported for content filter", a)
}

Type guard

func isSupportedAsset(a oam.Asset) bool {
    switch a.(type) {
    case *oam.TLSCertificate, *oam.URL:
        return true
    }
    return false
}

Try / catch

err := sess.PutAsset(asset)
if err != nil && strings.Contains(err.Error(), "invalid asset type") {
    // skip unsupported asset and continue
    return nil
}

Prevention

When it happens

Trigger: PutAsset is called with an asset whose concrete oam type is not handled by the switch in defaultContentFilter (a type without a case like oam.TLSCertificate or oam.URL).

Common situations: A newly added oam asset type in a newer version whose filter mapping was not yet added; a plugin emitting a custom/unsupported asset type; type assertion producing an unexpected asset variant.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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