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() during the revoke command's parallel data fetch. The *shared.ApiError Msg is embedded into 'error fetching pending invites: %s'. It means the pending-invites lookup failed, so the command cannot complete its combined users+invites view.

Source

Thrown at app/cli/cmd/revoke.go:53

	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
	}()

	for i := 0; i < 2; i++ {
		err := <-errCh
		if err != nil {
			term.StopSpinner()
			term.OutputErrorAndExit(err.Error())
		}
	}

	term.StopSpinner()

	type userInfo struct {
		Id       string
		IsInvite bool

View on GitHub (pinned to e2d772072e)

Solutions

  1. Re-authenticate to refresh credentials
  2. Check that your role in the org permits viewing pending invites
  3. Verify API reachability (network/proxy/firewall)
  4. Read the embedded err.Msg for the HTTP status code and address it specifically

Example fix

// before
errCh <- fmt.Errorf("error fetching pending invites: %s", err.Msg)
// after
if errors.Is(err, shared.ErrUnauthorized) {
	errCh <- fmt.Errorf("error fetching pending invites: %s (re-authenticate with `auth login`)", err.Msg)
} else {
	errCh <- fmt.Errorf("error fetching pending invites: %s", err.Msg)
}
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-flight: confirm the token is present and not expired before fetching invites
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 == 403 {
		return fmt.Errorf("your role cannot view pending invites: %s", ae.Msg)
	}
	return fmt.Errorf("error fetching pending invites: %w", err)
}

Prevention

When it happens

Trigger: ListPendingInvites() returning a non-nil *shared.ApiError: expired/invalid credentials, insufficient permission to view org invites, or server/network failure while the goroutine is running.

Common situations: Members-only accounts that cannot view invites; API downtime; token revoked between login and command execution.

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