{"record":{"id":"873beeb6a88446b0","repo":"owasp-amass/amass","slug":"failed-to-extract-the-autonomoussystem-asset","errorCode":null,"errorMessage":"failed to extract the AutonomousSystem asset","messagePattern":"failed to extract the AutonomousSystem asset","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/plugins/scrape/ipverse.go","lineNumber":79,"sourceCode":"\t\tTransforms:   []string{string(oam.Netblock)},\n\t\tEventType:    oam.AutonomousSystem,\n\t\tCallback:     v.check,\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\tv.log.Info(\"Plugin started\")\n\treturn nil\n}\n\nfunc (v *ipverse) Stop() {\n\tv.log.Info(\"Plugin stopped\")\n}\n\nfunc (v *ipverse) check(e *et.Event) error {\n\tas, ok := e.Entity.Asset.(*oamnet.AutonomousSystem)\n\tif !ok {\n\t\treturn errors.New(\"failed to extract the AutonomousSystem asset\")\n\t}\n\n\tif _, found := v.asns[as.Number]; found {\n\t\treturn nil\n\t}\n\n\trec := v.query(e.Session, e.Entity)\n\tif rec == nil {\n\t\treturn nil\n\t}\n\tv.asns[as.Number] = struct{}{}\n\n\tfor _, cidr := range append(rec.CIDRs.IPv4, rec.CIDRs.IPv6...) {\n\t\t_ = support.AddNetblock(e.Session, cidr, as.Number, v.source)\n\t}\n\treturn nil\n}\n","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/engine/plugins/scrape/ipverse.go#L61-L97","documentation":"Thrown by the ipverse scrape plugin's check method when the event's Entity.Asset cannot be asserted to *oamnet.AutonomousSystem. The plugin only handles ASN assets and pre-loads ASNs; events carrying other asset types fail this assertion. It indicates the plugin received an asset type it was not designed to process.","triggerScenarios":"An event with an asset other than *oamnet.AutonomousSystem (e.g. FQDN, IPAddress) is passed to ipverse.check, so the type assertion as, ok := e.Entity.Asset.(*oamnet.AutonomousSystem) fails.","commonSituations":"Custom pipelines sending IP/FQDN events to the ipverse plugin; broad event subscriptions; chaining plugins whose output asset types do not match ipverse's expected ASN input.","solutions":["Verify the upstream plugin emits AutonomousSystem assets before ipverse runs","Check the ASN is being produced (e.g. by a reverse-whois/ASN plugin) before ipverse checks its cache","Restrict the events routed to ipverse to ASN-related asset types","Return nil for non-ASN assets if the plugin should skip them silently"],"exampleFix":"// before\nas, ok := e.Entity.Asset.(*oamnet.AutonomousSystem)\nif !ok {\n\treturn errors.New(\"failed to extract the AutonomousSystem asset\")\n}\n// after\nas, ok := e.Entity.Asset.(*oamnet.AutonomousSystem)\nif !ok {\n\treturn nil // skip non-ASN assets\n}","handlingStrategy":"type-guard","validationCode":"if as, ok := e.Entity.Asset.(*oamnet.AutonomousSystem); !ok {\n\treturn nil // not an ASN; skip\n}","typeGuard":"func isAutonomousSystem(e *et.Event) (*oamnet.AutonomousSystem, bool) {\n\tas, ok := e.Entity.Asset.(*oamnet.AutonomousSystem)\n\treturn as, ok\n}","tryCatchPattern":"if err := plugin.Check(e); err != nil {\n\tif strings.Contains(err.Error(), \"failed to extract the AutonomousSystem asset\") {\n\t\tcontinue // skip non-ASN events\n\t}\n\treturn err\n}","preventionTips":["Only route ASN-related events to the ipverse plugin","Confirm upstream producers emit AutonomousSystem assets","Use a shared type-guard helper for asset extraction","Treat non-matching asset types as skip, not failure"],"tags":["go","type-assertion","asn","plugin"],"backgroundTag":"incompatible-source-type","analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}