owasp-amass/amass · error

failed to create the OAM Service asset

Error message

failed to create the OAM Service asset

What it means

Thrown by support.CreateServiceAsset when session.DB().CreateAsset fails to persist a new OAM Service asset in the graph database. If no matching service asset exists and the database write returns an error or nil asset, the helper gives up with this error. It wraps a lower-level database write failure.

Source

Thrown at engine/plugins/support/database.go:204

				if found {
					num++
				} else {
					continue
				}
			}
		}

		if num > 0 {
			match = srv
			break
		}
	}

	if match == nil {
		if a, err := session.DB().CreateAsset(ctx, serv); err == nil && a != nil {
			match = a
		} else {
			return nil, errors.New("failed to create the OAM Service asset")
		}
	}

	_, err := session.DB().CreateEdge(ctx, &dbt.Edge{
		Relation:   rel,
		FromEntity: src,
		ToEntity:   match,
	})
	return match, err
}

View on GitHub (pinned to 79299dce87)

Solutions

  1. Verify the graph database is running and reachable from the session
  2. Check DB credentials and connection configuration in the session
  3. Inspect the underlying CreateAsset error (add logging) to find the constraint/schema cause
  4. Retry the scan after resolving database connectivity issues

Example fix

// before
if a, err := session.DB().CreateAsset(ctx, serv); err == nil && a != nil {
	match = a
} else {
	return nil, errors.New("failed to create the OAM Service asset")
}
// after
a, err := session.DB().CreateAsset(ctx, serv)
if err != nil {
	return nil, fmt.Errorf("failed to create the OAM Service asset: %w", err)
}
if a == nil {
	return nil, errors.New("failed to create the OAM Service asset: nil result")
}
match = a
Defensive patterns

Strategy: try-catch

Validate before calling

if err := session.DB().Ping(ctx); err != nil {
	return fmt.Errorf("database unavailable: %w", err)
}

Type guard

null

Try / catch

asset, err := support.CreateServiceAsset(ctx, session, src, rel, serv)
if err != nil {
	if strings.Contains(err.Error(), "failed to create the OAM Service asset") {
		// DB write failed; check DB connectivity and retry
		log.WithError(err).Error("service asset creation failed")
		return err
	}
	return err
}

Prevention

When it happens

Trigger: CreateServiceAsset is called (e.g. via store) with a service that has no existing match, and CreateAsset returns an error (DB unavailable, schema constraint, connection failure) or a nil asset.

Common situations: Graph database (e.g. OrientDB) is down or unreachable; wrong DB credentials; database schema/constraint violations on the Service vertex; transient connection drops during scans.

Related errors


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