plandex-ai/plandex · error

error prompting auto add domain users: %v

Error message

error prompting auto add domain users: %v

What it means

This error wraps a failure from promptAutoAddUsersIfValid, which asks the user (via term.ConfirmYesNo) whether to enable domain auto-join for the org being created. It fires only in non-local mode when the yes/no confirmation prompt fails, aborting org creation.

Source

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

func createOrg(isLocalMode bool) (*shared.Org, error) {
	var err error
	var name string
	var autoAddDomainUsers bool

	if isLocalMode {
		name = "Local Org"
	} else {
		name, err = term.GetRequiredUserStringInput("Org name:")
	}
	if err != nil {
		return nil, fmt.Errorf("error prompting org name: %v", err)
	}

	if !isLocalMode {
		autoAddDomainUsers, err = promptAutoAddUsersIfValid(Current.Email)
		if err != nil {
			return nil, fmt.Errorf("error prompting auto add domain users: %v", err)
		}
	}

	term.StartSpinner("")
	res, apiErr := apiClient.CreateOrg(shared.CreateOrgRequest{
		Name:               name,
		AutoAddDomainUsers: autoAddDomainUsers,
	})
	term.StopSpinner()

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

	return &shared.Org{Id: res.Id, Name: name}, nil
}

func promptAutoAddUsersIfValid(email string) (bool, error) {

View on GitHub (pinned to e2d772072e)

Solutions

  1. Run the command in an interactive terminal so the yes/no prompt can be answered
  2. Pre-create the org or use local mode to skip the interactive auto-join prompt
  3. Verify stdin is not redirected or closed
  4. Retry if the terminal I/O error was transient
Defensive patterns

Strategy: validation

Validate before calling

// ensure the auto-join prompt can be answered
fi, _ := os.Stdin.Stat()
if fi == nil || (fi.Mode()&os.ModeCharDevice) == 0 {
    return fmt.Errorf("auto-join confirmation requires an interactive terminal")
}

Try / catch

org, err := createOrg(false)
if err != nil {
    if strings.Contains(err.Error(), "error prompting auto add domain users") {
        // re-run interactively or default autoAddDomainUsers to false
    }
    return err
}

Prevention

When it happens

Trigger: Calling createOrg in non-local mode where the account email's domain is not an email-service domain, and the subsequent term.ConfirmYesNo("Enable auto-join for <domain>?") returns an error (stdin closed, EOF, I/O failure).

Common situations: Non-interactive environments (CI, piped stdin) where the auto-join confirmation cannot be answered; broken terminal input during onboarding of a new org with a corporate email domain.

Related errors


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