owasp-amass/amass · warning

failed to extract the locations

Error message

failed to extract the locations

What it means

After querying location edges, getContactRecordLocations filters them to those whose To.Asset is an *oamcon.Location. If zero survive the type filter, it returns this error — edges existed but none pointed at an actual Location asset.

Source

Thrown at engine/plugins/horizontals/plugin.go:355

	seconds := 5 * len(edges)
	lctx, cancel := context.WithTimeout(sess.Ctx(), time.Duration(seconds)*time.Second)
	defer cancel()

	var results []*dbt.Entity
	for _, edge := range edges {
		to, err := sess.DB().FindEntityById(lctx, edge.ToEntity.ID)
		if err != nil {
			continue
		}

		if _, valid := to.Asset.(*oamcon.Location); valid {
			results = append(results, to)
		}
	}

	if len(results) == 0 {
		return nil, errors.New("failed to extract the locations")
	}
	return results, nil
}

func (h *horizPlugin) getOrganizationLocations(sess et.Session, o *dbt.Entity) ([]*dbt.Entity, error) {
	since, err := support.TTLStartTime(sess.Config(),
		string(oam.Organization), string(oam.Location), h.name)
	if err != nil {
		return nil, err
	}

	ctx, cancel := context.WithTimeout(sess.Ctx(), 5*time.Second)
	defer cancel()

	edges, err := sess.DB().OutgoingEdges(ctx, o, since, "hq_address", "location")
	if err != nil || len(edges) == 0 {
		return nil, errors.New("zero locations found")
	}

View on GitHub (pinned to 79299dce87)

Solutions

  1. Update oamcon type assertions to cover new location asset variants
  2. Re-run enumeration to refresh possibly stale edge data
  3. Log the actual asset types found to diagnose which type is appearing instead
  4. Skip such contact records and continue rather than failing the whole lookup

Example fix

// before
if _, valid := to.Asset.(*oamcon.Location); valid {
// after
switch to.Asset.(type) {
case *oamcon.Location, *oamcon.NewLocation: // cover new variants
    results = append(results, to)
}
Defensive patterns

Strategy: type-guard

Type guard

func isLocationEdge(to *dbt.Entity) bool {
    _, ok := to.Asset.(*oamcon.Location)
    return ok
}

Try / catch

locs, err := getContactRecordLocations(sess, cr)
if err != nil {
    if errors.Is(err, errExtractLocations) {
        return nil // skip records whose edges aren't Location assets
    }
    return err
}

Prevention

When it happens

Trigger: OutgoingEdges returned edges for the contact record, but none of the edge destinations hold a *oamcon.Location asset (different asset types on the edge or malformed data).

Common situations: A plugin version emitting a new/different location asset type not matched by the *oamcon.Location assertion; corrupt or stale graph data; version drift between oam type definitions.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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