{"record":{"id":"617ff2cb857d6bfb","repo":"owasp-amass/amass","slug":"failed-to-create-the-jurisdiction-claim-s-for-org","errorCode":null,"errorMessage":"failed to create the jurisdiction claim %s for organization %s","messagePattern":"failed to create the jurisdiction claim (.+?) for organization (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/plugins/support/org/claims.go","lineNumber":149,"sourceCode":"\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.LegalName, name)\n}\n\nfunc CreateOrgJurisdictionClaim(sess et.Session, orgent *dbt.Entity, jurisdiction string) error {\n\tctx, cancel := context.WithTimeout(sess.Ctx(), 10*time.Second)\n\tdefer cancel()\n\n\tif _, err := sess.DB().CreateEntityProperty(ctx, orgent, &oamgen.SimpleProperty{\n\t\tPropertyName:  \"jurisdiction\",\n\t\tPropertyValue: jurisdiction,\n\t}); err == nil {\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"failed to create the jurisdiction claim %s for organization %s\", jurisdiction, orgent.Asset.Key())\n}\n\nfunc FindOrgByNormNameAndJurisdictionClaim(sess et.Session, norm, jurisdiction string) (*dbt.Entity, error) {\n\tvar country string\n\tif parts := strings.Split(jurisdiction, \"-\"); len(parts) == 2 {\n\t\tcountry = parts[0]\n\t}\n\n\tctx, cancel := context.WithTimeout(sess.Ctx(), 10*time.Second)\n\tdefer cancel()\n\n\torgents, err := sess.DB().FindEntitiesByContent(ctx, oam.Organization, time.Time{}, 1, dbt.ContentFilters{\n\t\t\"name\": norm,\n\t})\n\tif err != nil || len(orgents) == 0 {\n\t\treturn nil, fmt.Errorf(\"failed to obtain organizations with norm name %s\", norm)\n\t}\n","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/engine/plugins/support/org/claims.go#L131-L167","documentation":"CreateOrgJurisdictionClaim adds a SimplePropertyClaim (property name 'jurisdiction', value the jurisdiction string) linking to the Organization asset. If that claim-creation call returns an error, the function discards the underlying cause and returns this generic failure message including the jurisdiction and the organization's key.","triggerScenarios":"Called by CreateOrgAsset after resolving/creating the Organization; the underlying AddSimplePropertyClaim-style call fails — typically a DB write error, context timeout (10s), or the asset being concurrently deleted. The wrapped error is discarded, so only this message surfaces.","commonSituations":"Asset DB write contention or outage during heavy scans; jurisdiction string invalid/empty reaching the claim writer; the 10s context expires under DB latency; concurrent plugins mutating the same Organization asset.","solutions":["Inspect the code to see the discarded error from the claim-creation call (the err is swallowed) — add logging around that call to surface the real cause.","Verify the asset DB is writable and responsive; check for write contention between concurrent scans.","Confirm the jurisdiction value is a valid country code (CreateOrgAsset normalizes via countries.ByName before calling).","Retry the operation: the claim is idempotent, so re-running the scan/plugin recreates it."],"exampleFix":"// before\nif err := claim(...); err == nil {\n    return nil\n}\nreturn fmt.Errorf(\"failed to create the jurisdiction claim %s for organization %s\", jurisdiction, orgent.Asset.Key())\n// after\nif err := claim(...); err == nil {\n    return nil\n} else {\n    return fmt.Errorf(\"failed to create the jurisdiction claim %s for organization %s: %w\", jurisdiction, orgent.Asset.Key(), err)\n}","handlingStrategy":"try-catch","validationCode":"if orgent == nil || orgent.Asset == nil || jurisdiction == \"\" {\n    return errors.New(\"cannot create jurisdiction claim: missing organization or jurisdiction\")\n}","typeGuard":null,"tryCatchPattern":"if err := org.CreateOrgJurisdictionClaim(sess, orgent, jurisdiction); err != nil {\n    log.Printf(\"jurisdiction claim failed for %s: %v (underlying DB write error is discarded upstream)\", orgent.Asset.Key(), err)\n    // retry later; claim creation is idempotent\n}","preventionTips":["Log the discarded underlying error by wrapping the inner claim call.","Ensure the DB backend is writable and not under contention.","Validate jurisdiction is a valid country code before calling.","Retry failed claim writes; they are idempotent."],"tags":["database","write-failed","claim","amass"],"backgroundTag":"database-write-failed","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"}