{"record":{"id":"6e44e3703a264ff4","repo":"pulumi/pulumi","slug":"user-s-is-not-a-member-of-organization-s-6e44e3","errorCode":null,"errorMessage":"user %s is not a member of organization %s","messagePattern":"user (.+?) is not a member of organization (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/pulumi/policy/policy_issue_list.go","lineNumber":153,"sourceCode":"\tuserName, orgs, _, err := cloudBackend.CurrentUser()\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\torg := orgFlag\n\tif org == \"\" {\n\t\tdefaultOrg, err := cloudBackend.GetDefaultOrg(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", err\n\t\t}\n\t\torg = defaultOrg\n\t}\n\tif org == \"\" {\n\t\torg = userName\n\t}\n\n\tif !slices.Contains(orgs, org) && org != userName {\n\t\treturn nil, \"\", fmt.Errorf(\"user %s is not a member of organization %s\", userName, org)\n\t}\n\n\treturn cloudBackend.Client(), org, nil\n}\n\n// defaultPageSize is the number of items fetched per API call.\nconst policyIssueDefaultPageSize = 100\n\n// runPolicyIssueList is the cobra-decoupled command body so tests can drive\n// it directly without spinning up the flag parser.\nfunc runPolicyIssueList(\n\tctx context.Context, w io.Writer,\n\tfactory policyIssueListClientFactory, args policyIssueListArgs,\n) error {\n\tc, org, err := factory(ctx, args.org)\n\tif err != nil {\n\t\treturn err\n\t}","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/cmd/pulumi/policy/policy_issue_list.go#L135-L171","documentation":"Same membership check as error 1335, in the list variant (policy_issue_list.go): when no --organization is given it defaults to the current username, and if the explicitly provided org is not in the user's membership list (slices.Contains(orgs, org) fails) the command returns this error before calling ListPolicyIssues.","triggerScenarios":"`pulumi policy policy-issue list --organization <org>` where the authenticated user is not a member of <org>, the org name is misspelled, or the login token's identity was removed from the org.","commonSituations":"Listing issues for a new org you were just invited to but whose membership hasn't propagated to your token (re-login fixes it); enumerating another team's org issues; scripts hard-coding a renamed org.","solutions":["Double-check the org name; list your orgs via the Pulumi Cloud console or `pulumi whoami`","Re-login (`pulumi login`) to refresh org memberships in your token","Omit --organization to default to your username where applicable","Have an org admin grant you membership if access is required"],"exampleFix":"// before\npulumi policy policy-issue list --organization OldOrgName\n// after\npulumi policy policy-issue list --organization RenamedOrg","handlingStrategy":"validation","validationCode":"if !slices.Contains(userOrgs, requestedOrg) { return fmt.Errorf(\"org %q not in memberships %v\", requestedOrg, userOrgs) }","typeGuard":null,"tryCatchPattern":"err := runCmd(\"pulumi\", \"policy\", \"policy-issue\", \"list\", \"--organization\", org)\nif err != nil && strings.Contains(err.Error(), \"is not a member of organization\") {\n    // fall back to default org or re-login\n}","preventionTips":["Keep org names in config synced with actual Pulumi org slugs","Re-login after org membership changes","Default to the username's org when listing personal issues"],"tags":["cli","policy-issues","organization","permissions"],"backgroundTag":"org-membership-required","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}