{"record":{"id":"47dc26af6166155e","repo":"owasp-amass/amass","slug":"failed-to-create-the-oam-service-asset","errorCode":null,"errorMessage":"failed to create the OAM Service asset","messagePattern":"failed to create the OAM Service asset","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/plugins/support/database.go","lineNumber":204,"sourceCode":"\t\t\t\tif found {\n\t\t\t\t\tnum++\n\t\t\t\t} else {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif num > 0 {\n\t\t\tmatch = srv\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif match == nil {\n\t\tif a, err := session.DB().CreateAsset(ctx, serv); err == nil && a != nil {\n\t\t\tmatch = a\n\t\t} else {\n\t\t\treturn nil, errors.New(\"failed to create the OAM Service asset\")\n\t\t}\n\t}\n\n\t_, err := session.DB().CreateEdge(ctx, &dbt.Edge{\n\t\tRelation:   rel,\n\t\tFromEntity: src,\n\t\tToEntity:   match,\n\t})\n\treturn match, err\n}\n","sourceCodeStart":186,"sourceCodeEnd":215,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/engine/plugins/support/database.go#L186-L215","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the graph database is running and reachable from the session","Check DB credentials and connection configuration in the session","Inspect the underlying CreateAsset error (add logging) to find the constraint/schema cause","Retry the scan after resolving database connectivity issues"],"exampleFix":"// before\nif a, err := session.DB().CreateAsset(ctx, serv); err == nil && a != nil {\n\tmatch = a\n} else {\n\treturn nil, errors.New(\"failed to create the OAM Service asset\")\n}\n// after\na, err := session.DB().CreateAsset(ctx, serv)\nif err != nil {\n\treturn nil, fmt.Errorf(\"failed to create the OAM Service asset: %w\", err)\n}\nif a == nil {\n\treturn nil, errors.New(\"failed to create the OAM Service asset: nil result\")\n}\nmatch = a","handlingStrategy":"try-catch","validationCode":"if err := session.DB().Ping(ctx); err != nil {\n\treturn fmt.Errorf(\"database unavailable: %w\", err)\n}","typeGuard":"null","tryCatchPattern":"asset, err := support.CreateServiceAsset(ctx, session, src, rel, serv)\nif err != nil {\n\tif strings.Contains(err.Error(), \"failed to create the OAM Service asset\") {\n\t\t// DB write failed; check DB connectivity and retry\n\t\tlog.WithError(err).Error(\"service asset creation failed\")\n\t\treturn err\n\t}\n\treturn err\n}","preventionTips":["Verify DB connectivity before starting scans","Check graph DB credentials and schema constraints","Wrap the underlying error with %w for diagnosis","Retry transient DB failures with backoff"],"tags":["go","database","oam","asset"],"backgroundTag":"database-write-failed","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"}