{"record":{"id":"44bacf7864dc3648","repo":"owasp-amass/amass","slug":"failed-to-obtain-the-entity-for-identifier-s-s","errorCode":null,"errorMessage":"failed to obtain the entity for Identifier - %s:%s","messagePattern":"failed to obtain the entity for Identifier - (.+?):(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"engine/plugins/support/org/claims.go","lineNumber":59,"sourceCode":"\t}\n\n\tif err := createRelation(ctx, sess, orgent, &oamgen.SimpleRelation{Name: \"id\"}, ident, src); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ident, nil\n}\n\nfunc FindOrgByNameClaim(sess et.Session, name string, src *et.Source) (*dbt.Entity, error) {\n\tctx, cancel := context.WithTimeout(sess.Ctx(), 30*time.Second)\n\tdefer cancel()\n\n\tids, err := sess.DB().FindEntitiesByContent(ctx, oam.Identifier, time.Time{}, 1, dbt.ContentFilters{\n\t\t\"id\":      name,\n\t\t\"id_type\": oamgen.OrganizationName,\n\t})\n\tif err != nil || len(ids) != 1 {\n\t\treturn nil, fmt.Errorf(\"failed to obtain the entity for Identifier - %s:%s\", oamgen.OrganizationName, name)\n\t}\n\tident := ids[0]\n\n\tif edges, err := sess.DB().IncomingEdges(ctx, ident, time.Time{}, \"id\"); err == nil && len(edges) > 0 {\n\t\tfor _, edge := range edges {\n\t\t\tif tags, err := sess.DB().FindEdgeTags(ctx, edge, time.Time{}, src.Name); err != nil || len(tags) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif o, err := sess.DB().FindEntityById(ctx, edge.FromEntity.ID); err == nil && o != nil {\n\t\t\t\tif _, valid := o.Asset.(*oamorg.Organization); valid {\n\t\t\t\t\treturn o, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"failed to obtain the Organization associated with Identifier - %s:%s\", oamgen.OrganizationName, name)\n}","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/engine/plugins/support/org/claims.go#L41-L77","documentation":"FindOrgByNameClaim looks up an Organization entity in the asset graph by a name-type Identifier claim (id + id_type=organization_name). If FindEntitiesByContent errors or does not return exactly one identifier entity, the lookup is inconclusive and this error is returned rather than guessing which entity is meant.","triggerScenarios":"CreateOrgAsset calls FindOrgByNameClaim with an organization name that (a) has no organization_name identifier entity yet in the graph, (b) has multiple matching identifier entities (ambiguous), or (c) the underlying FindEntitiesByContent query fails (DB error or the 30s context times out).","commonSituations":"First run where the org was never discovered before; the graph DB is unavailable or slow so the DB query errors; another data source previously stored a duplicate organization_name identifier so len(ids) != 1; name casing/normalization differs from what was stored.","solutions":["Treat the error as a cache miss: callers like CreateOrgAsset intentionally fall through to create a new Organization asset, so verify whether the org genuinely does not exist before treating it as a fault.","Check the asset DB backend is reachable and healthy (connection, schema) since err != nil is folded into this message.","Search the graph for duplicate organization_name identifier entities for this name and remove duplicates so exactly one match exists.","Ensure the name passed matches the stored claim exactly (same casing/normalization) or provide a LegalName/RegistrationID so the caller can use alternative lookups.","If the 30s context timeout is the cause, address DB latency or increase the timeout."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// caller-side guard before expecting an org to exist\nids, err := sess.DB().FindEntitiesByContent(ctx, oam.Identifier, time.Time{}, 1, dbt.ContentFilters{\"id\": name, \"id_type\": oamgen.OrganizationName})\nif err != nil || len(ids) != 1 {\n    // treat as not-found: proceed with creation or use alternate lookup keys\n}","typeGuard":"func hasSingleIdentifier(ids []*dbt.Entity) bool { return len(ids) == 1 }","tryCatchPattern":"if orgent, err := org.FindOrgByNameClaim(sess, name, src); err != nil {\n    // not-found is expected on first discovery: fall back to legal-name or create a new asset\n    orgent, _ = org.FindOrgByLegalNameClaim(sess, legalName, src)\n}","preventionTips":["Always pass the same source that originally created the claim.","Provide LegalName and RegistrationID on the Organization so alternate lookups can succeed.","Ensure the name string is normalized identically before storing and querying.","Monitor asset DB health to distinguish query errors from genuine misses."],"tags":["database","graph-lookup","not-found","amass"],"backgroundTag":"entity-not-found","analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}