{"record":{"id":"037471990c10fe9c","repo":"owasp-amass/amass","slug":"failed-to-obtain-the-entity-for-identifier-s-s-037471","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":"warning","filePath":"engine/plugins/support/org/rdap.go","lineNumber":58,"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 FindOrgByRDAPHandle(sess et.Session, handle 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\":      handle,\n\t\t\"id_type\": oamgen.ARINHandle,\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.ARINHandle, handle)\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.ARINHandle, handle)\n}","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/engine/plugins/support/org/rdap.go#L40-L76","documentation":"FindOrgByRDAPHandle throws this when the database lookup for the ARIN RDAP handle entity does not return exactly one matching entity. FindEntitiesByContent is queried with the identifier and a content filter {id: handle, id_type: ARINHandle}; any error, zero hits, or multiple hits produce this error. It means the entity for the RDAP handle could not be uniquely resolved.","triggerScenarios":"Calling FindOrgByRDAPHandle (via storeEntity) when: the DB query FindEntitiesByContent returns an error; no entity exists with id == handle and id_type == ARINHandle; or more than one entity matches so the result is ambiguous (len(ids) != 1).","commonSituations":"The RDAP/ARIN handle was never stored because the whois-arin source has not run or the handle data changed; duplicate entities with the same handle exist from repeated/parallel ingestions; stale DB contents after a schema or handle-format change; transient DB errors (closed session, context timeout).","solutions":["Re-run the ARIN/RDAP enumeration so the handle entity is stored before this lookup","Inspect the DB for duplicate entities with that id/id_type and deduplicate","Confirm the handle string format matches what was stored (exact match on id)","Check DB connectivity/session errors surfaced in err before assuming the data is missing","Log the returned ids count to distinguish zero-hit vs multi-hit ambiguity"],"exampleFix":"// before\nids, err := sess.DB().FindEntitiesByContent(ctx, oam.Identifier, time.Time{}, 1, dbt.ContentFilters{\"id\": handle, \"id_type\": oamgen.ARINHandle})\nif err != nil || len(ids) != 1 {\n    return nil, fmt.Errorf(\"failed to obtain the entity for Identifier - %s:%s\", oamgen.ARINHandle, handle)\n}\n// after\nids, err := sess.DB().FindEntitiesByContent(ctx, oam.Identifier, time.Time{}, 2, dbt.ContentFilters{\"id\": handle, \"id_type\": oamgen.ARINHandle})\nif err != nil {\n    return nil, fmt.Errorf(\"entity lookup error: %v\", err)\n}\nif len(ids) == 0 {\n    return nil, fmt.Errorf(\"no entity stored for handle %s; run RDAP enumeration first\", handle)\n}\nident := ids[0]","handlingStrategy":"validation","validationCode":"// Go: confirm the handle entity exists before the lookup\nids, _ := sess.DB().FindEntitiesByContent(ctx, oam.Identifier, time.Time{}, 2, dbt.ContentFilters{\"id\": handle, \"id_type\": oamgen.ARINHandle})\nif len(ids) != 1 {\n    return nil, fmt.Errorf(\"handle %s not uniquely resolvable (%d matches); rerun ARIN enumeration\", handle, len(ids))\n}","typeGuard":"func isEntityLookupFailure(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"failed to obtain the entity for Identifier\")\n}","tryCatchPattern":"ident, err := FindOrgByRDAPHandle(ctx, sess, e, oam, handle)\nif err != nil {\n    if isEntityLookupFailure(err) {\n        return nil, nil // skip: handle entity not present/ambiguous\n    }\n    return nil, err\n}","preventionTips":["Run ARIN/RDAP enumeration before handle-based org lookups","Deduplicate entities sharing the same id/id_type in the database","Keep handle strings unmodified (no normalization) between store and lookup","Check DB session health before attributing failures to missing data"],"tags":["rdap","arin","handle","database","osint"],"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-14T00:17:10.932Z"}