{"record":{"id":"13688c6a8e0bcd59","repo":"owasp-amass/amass","slug":"zero-names-provided-in-the-organization","errorCode":null,"errorMessage":"zero names provided in the Organization","messagePattern":"zero names provided in the Organization","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/plugins/support/org/find.go","lineNumber":154,"sourceCode":"\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil, false\n}\n\nfunc existsAndSharesLocEntity(sess et.Session, obj *dbt.Entity, o *oamorg.Organization) (*dbt.Entity, error) {\n\tvar names []string\n\tvar locs []*dbt.Entity\n\n\tif o.Name != \"\" {\n\t\tnames = append(names, o.Name)\n\t}\n\tif o.LegalName != \"\" {\n\t\tnames = append(names, o.LegalName)\n\t}\n\tif len(names) == 0 {\n\t\treturn nil, errors.New(\"zero names provided in the Organization\")\n\t}\n\n\tctx, cancel := context.WithTimeout(sess.Ctx(), 30*time.Second)\n\tdefer cancel()\n\n\tif edges, err := sess.DB().OutgoingEdges(ctx, obj, time.Time{}, \"legal_address\", \"hq_address\", \"location\"); err == nil {\n\t\tfor _, edge := range edges {\n\t\t\tif a, err := sess.DB().FindEntityById(ctx, edge.ToEntity.ID); err == nil && a != nil {\n\t\t\t\tif _, ok := a.Asset.(*oamcon.Location); ok {\n\t\t\t\t\tlocs = append(locs, a)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// get all locations that match the ones discovered on the graph\n\tlocs = append(locs, matchingLocations(sess, locs)...)\n","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/engine/plugins/support/org/find.go#L136-L172","documentation":"existsAndSharesLocEntity builds a list of candidate names (Name and LegalName) from an oamorg.Organization to search the graph for an existing matching org. If the Organization struct has neither a Name nor a LegalName set, there is nothing to match on, so the function refuses to proceed and returns this error instead of doing a meaningless graph query.","triggerScenarios":"Calling CreateOrgAsset (or the dedup path it triggers via dedupChecks -> existsAndSharesLocEntity) with an Organization whose Name == \"\" and LegalName == \"\". Note CreateOrgAsset's own o.Name check rejects a missing Name, so this fires on the dedup path where LegalName was also empty but the empty-name org reached this helper, e.g. via FindOrg calls that skip the public validation.","commonSituations":"Constructing an Organization struct programmatically (from parsed RDAP/registration data) and forgetting to populate Name; data source returns an empty or whitespace name that gets stored as \"\"; unmarshalling JSON into Organization where the name key is misspelled or absent.","solutions":["Populate o.Name (or at least o.LegalName) before invoking org lookup/creation APIs","Trim and validate the name at data-ingestion time so empty strings never become an Organization","Skip org-creation entirely when the source yields no usable organization name","Check callers (createOrgInvestors, getOrganization, storeEntity, storeContact, store) to ensure they don't pass zero-value Organization structs"],"exampleFix":"// before\norg := &oamorg.Organization{LegalName: \"\"}\nCreateOrgAsset(sess, obj, rel, org, src)\n\n// after\nif org.Name == \"\" && org.LegalName == \"\" {\n    return nil, fmt.Errorf(\"organization has no name; skipping\")\n}\nCreateOrgAsset(sess, obj, rel, org, src)","handlingStrategy":"validation","validationCode":"if o == nil || (o.Name == \"\" && o.LegalName == \"\") {\n    return fmt.Errorf(\"organization must have a Name or LegalName before lookup\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always populate Name when constructing oamorg.Organization","Trim and reject whitespace-only names at extraction time","Never pass zero-value Organization structs into lookup/creation APIs"],"tags":["go","validation","empty-name","organization"],"backgroundTag":"empty-required-field","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"}