pulumi/pulumi · error

user %s is not a member of organization %s

Error message

user %s is not a member of organization %s

What it means

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.

Source

Thrown at pkg/cmd/pulumi/policy/policy_issue_list.go:153

	userName, orgs, _, err := cloudBackend.CurrentUser()
	if err != nil {
		return nil, "", err
	}

	org := orgFlag
	if org == "" {
		defaultOrg, err := cloudBackend.GetDefaultOrg(ctx)
		if err != nil {
			return nil, "", err
		}
		org = defaultOrg
	}
	if org == "" {
		org = userName
	}

	if !slices.Contains(orgs, org) && org != userName {
		return nil, "", fmt.Errorf("user %s is not a member of organization %s", userName, org)
	}

	return cloudBackend.Client(), org, nil
}

// defaultPageSize is the number of items fetched per API call.
const policyIssueDefaultPageSize = 100

// runPolicyIssueList is the cobra-decoupled command body so tests can drive
// it directly without spinning up the flag parser.
func runPolicyIssueList(
	ctx context.Context, w io.Writer,
	factory policyIssueListClientFactory, args policyIssueListArgs,
) error {
	c, org, err := factory(ctx, args.org)
	if err != nil {
		return err
	}

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Double-check the org name; list your orgs via the Pulumi Cloud console or `pulumi whoami`
  2. Re-login (`pulumi login`) to refresh org memberships in your token
  3. Omit --organization to default to your username where applicable
  4. Have an org admin grant you membership if access is required

Example fix

// before
pulumi policy policy-issue list --organization OldOrgName
// after
pulumi policy policy-issue list --organization RenamedOrg
Defensive patterns

Strategy: validation

Validate before calling

if !slices.Contains(userOrgs, requestedOrg) { return fmt.Errorf("org %q not in memberships %v", requestedOrg, userOrgs) }

Try / catch

err := runCmd("pulumi", "policy", "policy-issue", "list", "--organization", org)
if err != nil && strings.Contains(err.Error(), "is not a member of organization") {
    // fall back to default org or re-login
}

Prevention

When it happens

Trigger: `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.

Common situations: 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.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/6e44e3703a264ff4. Report an issue: GitHub.