owasp-amass/amass · error

failed to discover or create the Organization asset

Error message

failed to discover or create the Organization asset

What it means

This is the terminal fallback in CreateOrgAsset: after all lookup paths (name claim, legal-name claim, legal-name edge, ancestor checks) fail to produce an existing orgent, and the creation branch also left orgent nil, the function returns this generic error indicating it could neither discover nor create the Organization asset.

Source

Thrown at engine/plugins/support/org/org.go:108

		// identify this caller as a source of the Organization asset
		_, _ = sess.DB().CreateEntityProperty(ctx, orgent, &oamgen.SourceProperty{
			Source:     src.Name,
			Confidence: src.Confidence,
		})

		if obj != nil && rel != nil && obj.ID != orgent.ID {
			ctx, cancel := context.WithTimeout(sess.Ctx(), 10*time.Second)
			defer cancel()

			if err := createRelation(ctx, sess, obj, rel, orgent, src); err != nil {
				return nil, err
			}
		}

		return orgent, nil
	}

	return nil, errors.New("failed to discover or create the Organization asset")
}

func genNormName(o *oamorg.Organization) string {
	name := o.Name

	if o.LegalName != "" {
		name = o.LegalName
	}

	return ExtractBrandName(strings.ToLower(name))
}

func genStableOrgID(o *oamorg.Organization) string {
	id := uuid.New().String()
	return fmt.Sprintf("%s:%s", o.Name, id)
}

func createRelation(ctx context.Context, sess et.Session, obj *dbt.Entity, rel oam.Relation, subject *dbt.Entity, src *et.Source) error {

View on GitHub (pinned to 79299dce87)

Solutions

  1. Enable debug logging around CreateOrgAsset to see which lookup/creation branch failed
  2. Check DB connectivity — this generic message usually masks a CreateAsset failure from [47]
  3. Re-run the operation after fixing the underlying DB issue; the state machine has no retry loop
  4. Audit callers for swallowed errors (e.g. `orgent, _ = FindOrgByLegalNameClaim(...)`) and log them instead

Example fix

// before
orgent, _ = FindOrgByLegalNameClaim(sess, o.LegalName, src)

// after
orgent, err = FindOrgByLegalNameClaim(sess, o.LegalName, src)
if err != nil {
    return nil, fmt.Errorf("legal-name lookup failed: %w", err)
}
Defensive patterns

Strategy: retry

Try / catch

orgent, err := CreateOrgAsset(sess, obj, rel, org, src)
if err != nil {
    log.Printf("discover-or-create failed: %v", err)
    // inspect DB state, then retry once
}

Prevention

When it happens

Trigger: Reached when orgent remains nil at the end of CreateOrgAsset — typically the result of an earlier silently-ignored lookup error or the failed CreateAsset path leaving orgent nil despite no error propagating directly.

Common situations: Compound failures: lookup errors were swallowed (e.g. FindOrgByLegalNameClaim's error is discarded with _) and creation also failed; inconsistent DB state; all dedup branches exhausted without a match or successful create.

Related errors


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