plandex-ai/plandex · error

error prompting no orgs: %v

Error message

error prompting no orgs: %v

What it means

resolveOrgAuth handles the case where the account has zero orgs: in local mode it auto-creates an org, otherwise it runs promptNoOrgs (interactive confirm). Any failure from that path is wrapped as this error. It surfaces when the authenticated user has no org access at all.

Source

Thrown at app/cli/auth/org.go:23

	"plandex-cli/term"
	"strings"

	shared "plandex-shared"
)

func resolveOrgAuth(orgs []*shared.Org, isLocalMode bool) (*shared.Org, error) {
	var org *shared.Org
	var err error

	if len(orgs) == 0 {
		if isLocalMode {
			org, err = createOrg(isLocalMode)
		} else {
			org, err = promptNoOrgs()
		}

		if err != nil {
			return nil, fmt.Errorf("error prompting no orgs: %v", err)
		}

	} else if len(orgs) == 1 {
		org = orgs[0]
	} else {
		org, err = selectOrg(orgs, isLocalMode)

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

	return org, nil
}

func promptNoOrgs() (*shared.Org, error) {
	fmt.Println("🧐 You don't have access to any orgs yet.\n\nTo join an existing org, ask an admin to either invite you directly or give your whole email domain access.\n\nOtherwise, you can go ahead and create a new org.")

View on GitHub (pinned to e2d772072e)

Solutions

  1. Run the command in an interactive terminal so the confirm prompt can read stdin
  2. Ask the org admin to invite your user or enable email-domain access, then re-run
  3. Create an org in advance (web UI or local-mode auto-creation) so orgs is non-empty
  4. Check the wrapped inner error — if it's an API error, verify server-side org creation permissions

Example fix

// before
CI run: plandex command -> ConfirmYesNo reads EOF -> error prompting no orgs
// after
# pre-create org interactively once, or run locally with an org attached
plandex sign in && plandex orgs # then run command in CI
Defensive patterns

Strategy: validation

Validate before calling

orgs, err := auth.ListOrgsSafe() // or apiClient.ListOrgs()
if err == nil && len(orgs) == 0 && !isTTY(os.Stdin) {
	return fmt.Errorf("no orgs and no TTY to prompt; create/join an org first")
}

Type guard

func canPromptNoOrgs(interactive bool) bool { return interactive && term.IsTerminal(os.Stdin.Fd()) }

Try / catch

org, err := resolveOrgAuth(orgs, isLocalMode)
if err != nil {
	if strings.Contains(err.Error(), "prompting no orgs") {
		// non-interactive or API failure: instruct user to join/create an org
		fmt.Fprintln(os.Stderr, "Join or create an org first (ask an admin or use local mode).", err)
		os.Exit(1)
	}
	return err
}

Prevention

When it happens

Trigger: ListOrgs returns an empty list, isLocalMode is false, and promptNoOrgs fails — the ConfirmYesNo prompt errors (non-interactive terminal / EOF) or createOrg(false) inside promptNoOrgs fails (empty org name input, auto-add-users prompt failure, or CreateOrg API error).

Common situations: Running the CLI in CI or a non-TTY environment where the yes/no prompt can't read input; new account with no org membership; admin hasn't granted domain access; org creation rejected server-side (name conflict, permission).

Related errors


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