plandex-ai/plandex · error

error fetching pending invites: %s

Error message

error fetching pending invites: %s

What it means

This error wraps a failure from api.Client.ListPendingInvites() in the users command's parallel fetch. The *shared.ApiError Msg is embedded into 'error fetching pending invites: %s'. It means the pending-invite listing failed, preventing the users command from showing its combined member/invite/roles view.

Source

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

	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()
		if err != nil {
			errCh <- fmt.Errorf("error fetching org roles: %s", err.Msg)
			return
		}
		errCh <- nil

	}()

	for i := 0; i < 3; i++ {
		err := <-errCh

View on GitHub (pinned to e2d772072e)

Solutions

  1. Re-authenticate to refresh the token
  2. Verify your org role permits viewing pending invites
  3. Check API reachability (network, proxy, firewall)
  4. Use the embedded err.Msg status code to identify auth vs server issues

Example fix

// before
errCh <- fmt.Errorf("error fetching pending invites: %s", err.Msg)
// after
if err.Status == 403 {
	errCh <- fmt.Errorf("error fetching pending invites: %s (your role cannot view invites)", err.Msg)
} else {
	errCh <- fmt.Errorf("error fetching pending invites: %s", err.Msg)
}
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-flight: ensure an authenticated session exists before the users command
if api.Client == nil || api.Client.Token == "" {
	return fmt.Errorf("not authenticated")
}

Type guard

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

Try / catch

pendingInvites, err := api.Client.ListPendingInvites()
if err != nil {
	if ae, ok := err.(*shared.ApiError); ok && ae.Status == 401 {
		return reauthAndRetry()
	}
	return fmt.Errorf("error fetching pending invites: %w", err)
}

Prevention

When it happens

Trigger: ListPendingInvites() returning non-nil *shared.ApiError: expired/invalid credentials, role lacking invite-visibility permission, or network/server failure in the goroutine.

Common situations: Non-admin users without invite visibility; token revoked mid-session; API downtime or rate limiting.

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/9d3e64ef26b02ddd. Report an issue: GitHub.