{"record":{"id":"07959aef4a893f9c","repo":"owasp-amass/amass","slug":"invalid-asset-type","errorCode":null,"errorMessage":"invalid asset type","messagePattern":"invalid asset type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/api/server/v1/utils.go","lineNumber":269,"sourceCode":"\tcase oam.Organization:\n\t\treturn dbt.ContentFilters{\"unique_id\": asset.Key()}, nil\n\tcase oam.Person:\n\t\treturn dbt.ContentFilters{\"unique_id\": asset.Key()}, nil\n\tcase oam.Phone:\n\t\treturn dbt.ContentFilters{\"e164\": asset.Key()}, nil\n\tcase oam.Product:\n\t\treturn dbt.ContentFilters{\"unique_id\": asset.Key()}, nil\n\tcase oam.ProductRelease:\n\t\treturn dbt.ContentFilters{\"name\": asset.Key()}, nil\n\tcase oam.Service:\n\t\treturn dbt.ContentFilters{\"unique_id\": asset.Key()}, nil\n\tcase oam.TLSCertificate:\n\t\treturn dbt.ContentFilters{\"serial_number\": asset.Key()}, nil\n\tcase oam.URL:\n\t\treturn dbt.ContentFilters{\"url\": asset.Key()}, nil\n\t}\n\n\treturn nil, errors.New(\"invalid asset type\")\n}\n","sourceCodeStart":251,"sourceCodeEnd":271,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/engine/api/server/v1/utils.go#L251-L271","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Identify the asset type being passed and add a case for it in defaultContentFilter with the correct content filter key","Upgrade to a version where the asset type is supported","Filter out unsupported asset types in the plugin before submitting via PutAsset"],"exampleFix":"// before\nreturn nil, errors.New(\"invalid asset type\")\n// after\ncase oam.NewIPAddress(net.IPv4zero): // add the missing case\n    return dbt.ContentFilters{\"address\": asset.Key()}, nil","handlingStrategy":"validation","validationCode":"switch a.(type) {\ncase *oam.TLSCertificate, *oam.URL: // supported types\ndefault:\n    return fmt.Errorf(\"asset type %T not supported for content filter\", a)\n}","typeGuard":"func isSupportedAsset(a oam.Asset) bool {\n    switch a.(type) {\n    case *oam.TLSCertificate, *oam.URL:\n        return true\n    }\n    return false\n}","tryCatchPattern":"err := sess.PutAsset(asset)\nif err != nil && strings.Contains(err.Error(), \"invalid asset type\") {\n    // skip unsupported asset and continue\n    return nil\n}","preventionTips":["Only submit asset types known to be handled by the server switch","After adding a new oam asset type, update defaultContentFilter immediately","Skip-and-log unsupported assets in plugins instead of failing the pipeline"],"tags":["assets","validation","switch","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}