{"record":{"id":"90d871d209d7e716","repo":"Tencent/WeKnora","slug":"organization-member-limit-reached","errorCode":null,"errorMessage":"organization member limit reached","messagePattern":"organization member limit reached","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/organization.go","lineNumber":36,"sourceCode":"// Default invite code validity in days; allowed values: 0 (never), 1, 7, 30\nconst DefaultInviteCodeValidityDays = 7\n\n// DefaultMemberLimit is the default max tenant-members per organization (0 = unlimited)\nconst DefaultMemberLimit = 200\n\n// ValidInviteCodeValidityDays are the allowed values for invite_code_validity_days\nvar ValidInviteCodeValidityDays = map[int]bool{0: true, 1: true, 7: true, 30: true}\n\nvar (\n\tErrOrgNotFound           = errors.New(\"organization not found\")\n\tErrOrgPermissionDenied   = errors.New(\"permission denied for this organization\")\n\tErrCannotRemoveOwner     = errors.New(\"cannot remove organization owner tenant\")\n\tErrCannotChangeOwnerRole = errors.New(\"cannot change organization owner tenant role\")\n\tErrTenantNotInOrg        = errors.New(\"tenant is not a member of this organization\")\n\tErrInvalidRole           = errors.New(\"invalid role\")\n\tErrInviteCodeExpired     = errors.New(\"invite code has expired\")\n\tErrInvalidValidityDays   = errors.New(\"invite_code_validity_days must be 0, 1, 7, or 30\")\n\tErrOrgMemberLimitReached = errors.New(\"organization member limit reached\")\n\tErrOrgMemberLimitTooLow  = errors.New(\"member limit cannot be lower than current member count\")\n)\n\n// organizationService implements OrganizationService.\n//\n// Plan 3 of #1303: a \"member\" of an org is a tenant, identified by\n// (org_id, tenant_id). The user_id of the requester is recorded only as\n// the representative for UI/audit; permission decisions ride on the\n// tenant's role inside the org.\ntype organizationService struct {\n\torgRepo        interfaces.OrganizationRepository\n\tuserRepo       interfaces.UserRepository\n\tshareRepo      interfaces.KBShareRepository\n\tagentShareRepo interfaces.AgentShareRepository\n}\n\n// NewOrganizationService creates a new organization service\nfunc NewOrganizationService(","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/organization.go#L18-L54","documentation":"Sentinel ErrOrgMemberLimitReached returned when accepting an invite/joining an org would push the member count to org.MemberLimit (default 200; 0 = unlimited) — the count check found count >= limit before adding the member. Capacity guard; surfaced as 400/409.","triggerScenarios":"Thrown at internal/application/service/organization.go:36 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Have an org admin raise MemberLimit or remove inactive members first","Reject the join request until capacity is available"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}