{"record":{"id":"12704dcbdde138b9","repo":"owasp-amass/amass","slug":"failed-to-extract-the-fqdn-asset-12704d","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/bing.go","lineNumber":78,"sourceCode":"\t\tTransforms:   []string{string(oam.FQDN)},\n\t\tEventType:    oam.FQDN,\n\t\tCallback:     b.check,\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\tb.log.Info(\"Plugin started\")\n\treturn nil\n}\n\nfunc (b *bing) Stop() {\n\tb.log.Info(\"Plugin stopped\")\n}\n\nfunc (b *bing) 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), b.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, b.source, since) {\n\t\tnames = append(names, b.query(e, fqdn.Name)...)\n\t\tsupport.MarkAssetMonitored(e.Session, e.Entity, b.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/bing.go#L60-L96","documentation":"The Bing scraping plugin's check() asserts e.Entity.Asset to *oamdns.FQDN before scraping search results for subdomains. If the event's asset is not an FQDN, the assertion fails and this error is returned. The event filter allowed a non-FQDN entity into the scraper.","triggerScenarios":"Events whose asset is not *oamdns.FQDN (URLs, IPs, certificates, etc.) reach bing.check because the subscription topic matches them.","commonSituations":"Scraping plugins subscribed to overly broad event topics; upstream emitting alternative domain asset types; plugin wiring errors in custom builds.","solutions":["Return nil instead of an error on cast failure so non-FQDN events are skipped","Filter the subscription so only FQDN events invoke check()","Confirm upstream emitters wrap domain names in *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 := b.check(ev); err != nil {\n\tif strings.Contains(err.Error(), \"failed to extract the FQDN\") {\n\t\tcontinue // not an FQDN; skip scraping\n\t}\n\tlog.Error(err)\n}","preventionTips":["Guard the asset cast before scraping and return nil on mismatch","Only subscribe scrape plugins to FQDN-typed events","Add regression tests that route non-FQDN events through check()"],"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"}