{"record":{"id":"6d4e4dd946bd0dec","repo":"owasp-amass/amass","slug":"failed-to-extract-the-fqdn-asset-6d4e4d","errorCode":null,"errorMessage":"failed to extract the FQDN asset","messagePattern":"failed to extract the FQDN asset","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/plugins/scrape/dnshistory.go","lineNumber":78,"sourceCode":"\t\tTransforms:   []string{string(oam.FQDN)},\n\t\tEventType:    oam.FQDN,\n\t\tCallback:     d.check,\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\td.log.Info(\"Plugin started\")\n\treturn nil\n}\n\nfunc (d *dnsHistory) Stop() {\n\td.log.Info(\"Plugin stopped\")\n}\n\nfunc (d *dnsHistory) check(e *et.Event) error {\n\tfqdn, ok := e.Entity.Asset.(*oamdns.FQDN)\n\tif !ok {\n\t\treturn errors.New(\"failed to extract the FQDN asset\")\n\t}\n\n\tif !support.HasSLDInScope(e) {\n\t\treturn nil\n\t}\n\n\tsince, err := support.TTLStartTime(e.Session.Config(), string(oam.FQDN), string(oam.FQDN), d.name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar names []*dbt.Entity\n\tif !support.AssetMonitoredWithinTTL(e.Session, e.Entity, d.source, since) {\n\t\tnames = append(names, d.query(e, fqdn.Name)...)\n\t\tsupport.MarkAssetMonitored(e.Session, e.Entity, d.source)\n\t}\n\n\tif len(names) > 0 {","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/engine/plugins/scrape/dnshistory.go#L60-L96","documentation":"The DNSHistory scraping plugin's check() asserts e.Entity.Asset to *oamdns.FQDN before querying historical DNS records. A failed assertion means the event carried a different asset type, so this error is returned and the event fails. Same routing family as the other scrape plugins.","triggerScenarios":"Events with non-*oamdns.FQDN assets (IPs, netblocks, URLs) reach dnsHistory.check due to a matching-but-too-broad event topic.","commonSituations":"Broad subscriptions in custom event graphs; upstream emitting wrapped or alternate domain name types; version drift between asset packages.","solutions":["Return nil on failed cast so mismatched events are ignored","Constrain the plugin subscription to FQDN-typed entities","Verify all FQDN event producers use *oamdns.FQDN"],"exampleFix":"// before\nfqdn, ok := e.Entity.Asset.(*oamdns.FQDN)\nif !ok {\n\treturn errors.New(\"failed to extract the FQDN asset\")\n}\n\n// after\nfqdn, ok := e.Entity.Asset.(*oamdns.FQDN)\nif !ok {\n\treturn nil\n}","handlingStrategy":"type-guard","validationCode":"if _, ok := e.Entity.Asset.(*oamdns.FQDN); !ok {\n\treturn nil\n}","typeGuard":"func eventFQDN(e *et.Event) (*oamdns.FQDN, bool) {\n\tf, ok := e.Entity.Asset.(*oamdns.FQDN)\n\treturn f, ok\n}","tryCatchPattern":"if err := d.check(ev); err != nil {\n\tif strings.Contains(err.Error(), \"failed to extract the FQDN\") {\n\t\tcontinue // non-FQDN event; skip\n\t}\n\tlog.Error(err)\n}","preventionTips":["Treat cast failure as skip-not-fail in check() handlers","Restrict DNS history plugin subscriptions to FQDN events","Pin asset package versions to avoid type identity drift across modules"],"tags":["go","type-assertion","fqdn","scraping"],"backgroundTag":"type-mismatch","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"}