{"record":{"id":"5283a6debf6e9a5d","repo":"owasp-amass/amass","slug":"failed-to-extract-the-fqdn-asset","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/known_fqdn.go","lineNumber":63,"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 *knownFQDN) Stop() {\n\td.log.Info(\"Plugin stopped\")\n}\n\nfunc (d *knownFQDN) 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 a, conf := e.Session.Scope().IsAssetInScope(fqdn, 0); conf == 0 || a == nil {\n\t\treturn nil\n\t} else if f, ok := a.(*oamdns.FQDN); !ok || f == nil || !strings.EqualFold(fqdn.Name, f.Name) {\n\t\treturn nil\n\t}\n\n\tsupport.AddSLDInScope(e)\n\td.process(e, d.lookup(e, e.Entity))\n\treturn nil\n}\n\nfunc (d *knownFQDN) lookup(e *et.Event, dom *dbt.Entity) []*dbt.Entity {\n\tctx, cancel := context.WithTimeout(e.Session.Ctx(), 60*time.Second)\n\tdefer cancel()\n\n\tnames, _ := db.FindByFQDNScope(ctx, e.Session.DB(), dom, time.Time{})","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/engine/plugins/known_fqdn.go#L45-L81","documentation":"The known-FQDN plugin's check() asserts e.Entity.Asset to *oamdns.FQDN to evaluate scope and known-ness of domain names. A failed assertion means the event is not an FQDN asset; the plugin returns this error, failing the event. It is an asset-type routing problem, not a data problem.","triggerScenarios":"Events with assets other than *oamdns.FQDN (e.g. IP, netblock, or certificate assets) invoke knownFQDN.check.","commonSituations":"Broad event subscriptions; new asset types added upstream that match the topic; using custom FQDN types instead of oamdns.FQDN.","solutions":["Return nil when the cast fails so non-FQDN events are ignored silently","Restrict the plugin's event subscription to FQDN assets","Ensure upstream FQDN events use *oamdns.FQDN exactly"],"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 asFQDN(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\n\t}\n\tlog.Error(err)\n}","preventionTips":["Silently skip events whose asset is not *oamdns.FQDN","Scope the plugin's event subscription to FQDN events","Never wrap domain names in custom structs when feeding the event bus"],"tags":["go","type-assertion","fqdn"],"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"}