{"record":{"id":"9b24dc808f1a86c1","repo":"owasp-amass/amass","slug":"failed-to-obtain-the-organization-associated-with-9b24dc","errorCode":null,"errorMessage":"failed to obtain the Organization associated with Identifier - %s:%s","messagePattern":"failed to obtain the Organization associated with Identifier - (.+?):(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"engine/plugins/support/org/gleif.go","lineNumber":75,"sourceCode":"\tif err != nil || len(ids) != 1 {\n\t\treturn nil, fmt.Errorf(\"failed to obtain the entity for Identifier - %s:%s\", oamgen.LEICode, lei)\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.LEICode, lei)\n}\n","sourceCodeStart":57,"sourceCodeEnd":77,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/engine/plugins/support/org/gleif.go#L57-L77","documentation":"FindOrgByLEICode in the org support package returns this error when it cannot resolve an Organization for a given LEI (Legal Entity Identifier) code. After exhausting its lookup paths (e.g. cached candidates matching the LEI via GLEIF data), the function falls through to a final sentinel error. It is a lookup-failure signal, not a runtime/infra error — the data simply was not found or did not match.","triggerScenarios":"Calling FindOrgByLEICode with an LEI code that has no matching Organization in the database/GLEIF-derived cache; the candidate loop over orgs associated with the identifier completes without a match (no org's LEI equals the requested lei).","commonSituations":"An LEI code is new, expired, or never ingested so no GLEIF record exists locally; typo'd or normalized-differently LEI (case/whitespace); reverse relation from identifier to organization was never created by an earlier enumeration stage; calling the lookup before the GLEIF source has run.","solutions":["Verify the LEI code is valid and exists in GLEIF (check via GLEIF API) before calling","Run the enumeration/data-ingestion stage that populates Organizations and their LEI tags first","Check the identifier/LEI for typos, casing, or whitespace normalization issues","Treat the error as expected for unknown LEIs: handle the not-found case in the caller instead of treating it as a bug","Log the exact lei value passed in to confirm the right key was used"],"exampleFix":"// before\norg, err := FindOrgByLEICode(ctx, sess, oam, lei)\nif err != nil {\n    return fmt.Errorf(\"lookup failed: %v\", err)\n}\n// after\norg, err := FindOrgByLEICode(ctx, sess, oam, lei)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to obtain the Organization\") {\n        return nil, ErrOrgNotFound // expected: LEI not in dataset\n    }\n    return fmt.Errorf(\"lookup failed: %v\", err)\n}","handlingStrategy":"try-catch","validationCode":"// Go: check the LEI is well-formed before lookup\nfunc validLEI(lei string) bool {\n    return len(lei) == 20 && regexp.MustCompile(`^[A-Z0-9]{20}$`).MatchString(lei)\n}\nif !validLEI(lei) { return nil, fmt.Errorf(\"invalid LEI: %q\", lei) }","typeGuard":"func isOrgNotFound(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"failed to obtain the Organization associated with Identifier\")\n}","tryCatchPattern":"org, err := FindOrgByLEICode(ctx, sess, oam, lei)\nif err != nil {\n    if isOrgNotFound(err) {\n        return nil, nil // not-found is an expected outcome\n    }\n    return nil, err\n}","preventionTips":["Validate LEI format (20 chars, ISO 17442) before lookup","Ensure GLEIF data ingestion ran before resolving orgs by LEI","Normalize LEI casing/whitespace before querying","Treat not-found as a normal, expected result for unknown identifiers"],"tags":["gleif","lei","entity-not-found","osint","recon"],"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"}