{"record":{"id":"df9f0273d7a8efb0","repo":"Tencent/WeKnora","slug":"tenant-is-not-a-member-of-this-organization","errorCode":null,"errorMessage":"tenant is not a member of this organization","messagePattern":"tenant is not a member of this organization","errorType":"http","errorClass":null,"httpStatus":404,"severity":"error","filePath":"internal/application/service/organization.go","lineNumber":32,"sourceCode":"\t\"github.com/Tencent/WeKnora/internal/types/interfaces\"\n\t\"github.com/google/uuid\"\n)\n\n// 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","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/organization.go#L14-L50","documentation":"Sentinel ErrTenantNotInOrg returned when resolving an org membership and the repository reports repository.ErrOrgMemberNotFound — the tenant is not (or no longer) a member of the organization, so org-scoped share operations are denied.","triggerScenarios":"Thrown at internal/application/service/organization.go:32 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Join the tenant to the organization (accept invite) before org-scoped operations","Verify the tenant/org ids; membership may have been revoked"],"exampleFix":null,"handlingStrategy":"type-guard","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"}