owasp-amass/amass · error

failed to extract the FQDN asset

Error message

failed to extract the FQDN asset

What it means

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.

Source

Thrown at engine/plugins/scrape/dnshistory.go:78

		Transforms:   []string{string(oam.FQDN)},
		EventType:    oam.FQDN,
		Callback:     d.check,
	}); err != nil {
		return err
	}

	d.log.Info("Plugin started")
	return nil
}

func (d *dnsHistory) Stop() {
	d.log.Info("Plugin stopped")
}

func (d *dnsHistory) check(e *et.Event) error {
	fqdn, ok := e.Entity.Asset.(*oamdns.FQDN)
	if !ok {
		return errors.New("failed to extract the FQDN asset")
	}

	if !support.HasSLDInScope(e) {
		return nil
	}

	since, err := support.TTLStartTime(e.Session.Config(), string(oam.FQDN), string(oam.FQDN), d.name)
	if err != nil {
		return err
	}

	var names []*dbt.Entity
	if !support.AssetMonitoredWithinTTL(e.Session, e.Entity, d.source, since) {
		names = append(names, d.query(e, fqdn.Name)...)
		support.MarkAssetMonitored(e.Session, e.Entity, d.source)
	}

	if len(names) > 0 {

View on GitHub (pinned to 79299dce87)

Solutions

  1. Return nil on failed cast so mismatched events are ignored
  2. Constrain the plugin subscription to FQDN-typed entities
  3. Verify all FQDN event producers use *oamdns.FQDN

Example fix

// before
fqdn, ok := e.Entity.Asset.(*oamdns.FQDN)
if !ok {
	return errors.New("failed to extract the FQDN asset")
}

// after
fqdn, ok := e.Entity.Asset.(*oamdns.FQDN)
if !ok {
	return nil
}
Defensive patterns

Strategy: type-guard

Validate before calling

if _, ok := e.Entity.Asset.(*oamdns.FQDN); !ok {
	return nil
}

Type guard

func eventFQDN(e *et.Event) (*oamdns.FQDN, bool) {
	f, ok := e.Entity.Asset.(*oamdns.FQDN)
	return f, ok
}

Try / catch

if err := d.check(ev); err != nil {
	if strings.Contains(err.Error(), "failed to extract the FQDN") {
		continue // non-FQDN event; skip
	}
	log.Error(err)
}

Prevention

When it happens

Trigger: Events with non-*oamdns.FQDN assets (IPs, netblocks, URLs) reach dnsHistory.check due to a matching-but-too-broad event topic.

Common situations: Broad subscriptions in custom event graphs; upstream emitting wrapped or alternate domain name types; version drift between asset packages.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06). Data as JSON: /api/errors/6d4e4dd946bd0dec. Report an issue: GitHub.