plandex-ai/plandex · error

error fetching users: %s

Error message

error fetching users: %s

What it means

This error wraps a failure from api.Client.ListUsers() in the users command's parallel fetch. The *shared.ApiError Msg is interpolated into 'error fetching users: %s'. It means the org user listing failed (auth, network, or server error), so the users command cannot display members.

Source

Thrown at app/cli/cmd/users.go:41

	RootCmd.AddCommand(usersCmd)
}

func listUsersAndInvites(cmd *cobra.Command, args []string) {
	auth.MustResolveAuthWithOrg()

	var userResp *shared.ListUsersResponse
	var pendingInvites []*shared.Invite
	var orgRoles []*shared.OrgRole

	errCh := make(chan error)

	term.StartSpinner("")

	go func() {
		var err *shared.ApiError
		userResp, err = api.Client.ListUsers()
		if err != nil {
			errCh <- fmt.Errorf("error fetching users: %s", err.Msg)
			return
		}
		errCh <- nil
	}()

	go func() {
		var err *shared.ApiError
		pendingInvites, err = api.Client.ListPendingInvites()
		if err != nil {
			errCh <- fmt.Errorf("error fetching pending invites: %s", err.Msg)
			return
		}
		errCh <- nil
	}()

	go func() {
		var err *shared.ApiError
		orgRoles, err = api.Client.ListOrgRoles()

View on GitHub (pinned to e2d772072e)

Solutions

  1. Re-authenticate (login flow) to refresh credentials
  2. Confirm your org role allows listing users
  3. Check network/proxy reachability to the API host
  4. Inspect err.Msg in the message for the exact status code and act on it

Example fix

// before
errCh <- fmt.Errorf("error fetching users: %s", err.Msg)
// after
if err.Status == 401 {
	errCh <- fmt.Errorf("error fetching users: %s (credentials expired — run `auth login`)", err.Msg)
} else {
	errCh <- fmt.Errorf("error fetching users: %s", err.Msg)
}
Defensive patterns

Strategy: type-guard

Validate before calling

// pre-flight: confirm credentials before listing users
if api.Client == nil || api.Client.APIKey == "" {
	return fmt.Errorf("not authenticated: run the login command first")
}

Type guard

func toApiError(err error) (*shared.ApiError, bool) {
	ae, ok := err.(*shared.ApiError)
	return ae, ok
}

Try / catch

userResp, err := api.Client.ListUsers()
if err != nil {
	if ae, ok := err.(*shared.ApiError); ok {
		switch ae.Status {
		case 401: return reauthAndRetry()
		case 403: return fmt.Errorf("insufficient permissions to list users")
		}
	}
	return fmt.Errorf("error fetching users: %w", err)
}

Prevention

When it happens

Trigger: ListUsers() returning non-nil *shared.ApiError while the users command runs: invalid/expired API key, network outage, insufficient org permissions, or 4xx/5xx server response.

Common situations: Logged-out or expired CLI session; role without member-list permission; VPN/proxy blocking the API; API incident.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/2b38202befceae05. Report an issue: GitHub.