{"record":{"id":"9d7a906f1bfbec2c","repo":"owasp-amass/amass","slug":"gleifsearchfuzzycompletions-no-results-found","errorCode":null,"errorMessage":"GLEIFSearchFuzzyCompletions: no results found","messagePattern":"GLEIFSearchFuzzyCompletions: no results found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"engine/plugins/api/gleif/gleif.go","lineNumber":49,"sourceCode":"func GLEIFSearchFuzzyCompletions(ctx context.Context, name string) (*FuzzyCompletionsResponse, error) {\n\tu := \"https://api.gleif.org/api/v1/fuzzycompletions?field=entity.legalName&q=\" + url.QueryEscape(name)\n\n\t_ = gleifLimit.Wait(ctx)\n\twctx, cancel := context.WithTimeout(ctx, 60*time.Second)\n\tdefer cancel()\n\n\tresp, err := amasshttp.RequestWebPage(wctx, amasshttp.DefaultClient, &amasshttp.Request{URL: u})\n\tif err != nil || resp.Body == \"\" {\n\t\tmsg := fmt.Sprintf(\"Failed to obtain the LEI record for %s: %s\", name, err)\n\t\treturn nil, fmt.Errorf(\"GLEIFSearchFuzzyCompletions: %s\", msg)\n\t}\n\n\tvar result FuzzyCompletionsResponse\n\tif err := json.Unmarshal([]byte(resp.Body), &result); err != nil {\n\t\tmsg := fmt.Sprintf(\"Failed to unmarshal the LEI record for %s: %s\", name, err)\n\t\treturn nil, fmt.Errorf(\"GLEIFSearchFuzzyCompletions: %s\", msg)\n\t} else if len(result.Data) == 0 {\n\t\treturn nil, fmt.Errorf(\"GLEIFSearchFuzzyCompletions: no results found\")\n\t}\n\n\treturn &result, nil\n}\n\n// GLEIFGetLEIRecord retrieves the LEI record for the given identifier.\nfunc GLEIFGetLEIRecord(ctx context.Context, id string) (*LEIRecord, error) {\n\tu := \"https://api.gleif.org/api/v1/lei-records/\" + id\n\n\t_ = gleifLimit.Wait(ctx)\n\twctx, cancel := context.WithTimeout(ctx, 60*time.Second)\n\tdefer cancel()\n\n\tresp, err := amasshttp.RequestWebPage(wctx,\n\t\tamasshttp.DefaultClient, &amasshttp.Request{URL: u})\n\tif err != nil || resp.StatusCode != 200 || resp.Body == \"\" {\n\t\treturn nil, err\n\t}","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/engine/plugins/api/gleif/gleif.go#L31-L67","documentation":"After successfully decoding the GLEIF response, GLEIFSearchFuzzyCompletions checks that at least one LEI record was returned. If result.Data is empty, it returns this sentinel-style error indicating the GLEIF API had no fuzzy matches for the queried name. This is an expected, non-fatal outcome for many inputs.","triggerScenarios":"A valid HTTP 200 response with a well-formed FuzzyCompletionsResponse whose Data array has length 0 — i.e., GLEIF found no organizations matching the submitted name.","commonSituations":"Querying GLEIF for a name that is not a registered legal entity (person names, product names, subdomains); misspelled or highly localized company names; querying with overly specific strings instead of the legal name.","solutions":["Confirm the queried name is an actual legal entity name registered with GLEIF; try the exact legal name.","Shorten the query to the core organization name to widen fuzzy matching.","Treat this as an expected empty result in the caller and skip this data source rather than failing the scan.","Try the exact-match GLEIF search endpoint or search by LEI identifier if known.","Check the query URL parameters (page size, filters) are not accidentally over-restricting results."],"exampleFix":"// before\n} else if len(result.Data) == 0 {\n\treturn nil, fmt.Errorf(\"GLEIFSearchFuzzyCompletions: no results found\")\n}\n// after\n} else if len(result.Data) == 0 {\n\treturn nil, nil // or a typed sentinel: ErrNoGLEIFResults, so callers can errors.Is and skip gracefully\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"result, err := GLEIFSearchFuzzyCompletions(ctx, name)\nif err != nil && strings.HasSuffix(err.Error(), \"no results found\") {\n\t// expected: continue with other data sources\n\treturn nil\n}","preventionTips":["Treat empty GLEIF results as expected for non-entity names","Query with the organization's legal name","Fall back to other registry data sources","Do not fail the whole scan on empty registry results"],"tags":["go","api","empty-result","gleif"],"backgroundTag":"empty-result-set","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"}