plandex-ai/plandex · error

error listing orgs: %v

Error message

error listing orgs: %v

What it means

After an account is selected and cached locally, SelectOrSignInOrCreate calls apiClient.ListOrgs() to fetch the organizations the account belongs to. If the Plandex server returns an API error, it is wrapped as `error listing orgs: %v` with the server's error message. This indicates the authenticated request to enumerate orgs failed, not a local problem.

Source

Thrown at app/cli/auth/account.go:76

		}
	}

	if selected == nil {
		return fmt.Errorf("error selecting account: account not found")
	}

	selectedAuth := *selected

	setAuth(&shared.ClientAuth{
		ClientAccount: selectedAuth,
	})

	term.StartSpinner("")
	orgs, apiErr := apiClient.ListOrgs()
	term.StopSpinner()

	if apiErr != nil {
		return fmt.Errorf("error listing orgs: %v", apiErr.Msg)
	}

	org, err := resolveOrgAuth(orgs, selectedAuth.IsLocalMode)

	if err != nil {
		return fmt.Errorf("error resolving org: %v", err)
	}

	err = setAuth(&shared.ClientAuth{
		ClientAccount:        *selected,
		OrgId:                org.Id,
		OrgName:              org.Name,
		OrgIsTrial:           org.IsTrial,
		IntegratedModelsMode: org.IntegratedModelsMode,
	})

	if err != nil {
		return fmt.Errorf("error setting auth: %v", err)

View on GitHub (pinned to e2d772072e)

Solutions

  1. Run `plandex signIn` (or delete stored auth and re-authenticate) to refresh the session token, then retry.
  2. Check connectivity to the Plandex server and verify PLANDEX_SERVER_URL / host configuration points at a reachable instance.
  3. Inspect the embedded apiErr.Msg for a server-side cause (e.g. 401/403) and fix on the server (invite status, account removal) as indicated.
Defensive patterns

Strategy: retry

Validate before calling

if !serverReachable(serverURL) { // e.g. net.DialTimeout before invoking
    return fmt.Errorf("plandex server %s unreachable; check URL/network first", serverURL)
}

Try / catch

if err := auth.SelectOrSignInOrCreate(); err != nil {
    if strings.Contains(err.Error(), "error listing orgs") {
        if isAuthErr(err) { return reSignInAndRetry() }
        if isTransient(err) { return retryWithBackoff(auth.SelectOrSignInOrCreate, 3) }
    }
    return err
}

Prevention

When it happens

Trigger: apiClient.ListOrgs() returns a non-nil ApiErr — server unreachable, invalid/expired account session token, server-side 4xx/5xx, or the account exists locally but has been revoked server-side.

Common situations: Server hostname changed or is behind a proxy that rejects the request; stale auth after server restart with different signing keys; expired session needing re-sign-in; network outage or VPN required.

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