plandex-ai/plandex · error

error creating org: %v

Error message

error creating org: %v

What it means

This error wraps a failed apiClient.CreateOrg call during createOrg. The server rejected or failed the org-creation request, and apiErr.Msg (the API's error message) is embedded. Client-side prompting succeeded, so the failure is on the API/network side.

Source

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

		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) {
	userDomain := strings.Split(email, "@")[1]
	var autoAddDomainUsers bool
	var err error
	if !shared.IsEmailServiceDomain(userDomain) {
		fmt.Println("With domain auto-join, you can allow any user with an email ending in @"+userDomain, "to auto-join this org.")
		autoAddDomainUsers, err = term.ConfirmYesNo(fmt.Sprintf("Enable auto-join for %s?", userDomain))

		if err != nil {
			return false, err
		}
	}
	return autoAddDomainUsers, nil

View on GitHub (pinned to e2d772072e)

Solutions

  1. Check network connectivity and that the Plandex API server is reachable
  2. Re-authenticate (sign in again) if the auth token may have expired
  3. Retry org creation; read the embedded apiErr.Msg for the server's specific reason
  4. If the server rejects the name or permissions, choose a different org name or contact an org admin

Example fix

// before
$ plandex-cli create-org
error creating org: unauthorized
// after
$ plandex-cli sign-in   # refresh auth
$ plandex-cli create-org
Defensive patterns

Strategy: retry

Validate before calling

// pre-flight connectivity check to the API host before creating an org
resp, err := http.Get(apiBaseURL + "/health")
if err != nil {
    return fmt.Errorf("API unreachable, fix network before creating org: %v", err)
}

Try / catch

org, err := createOrg(false)
if err != nil {
    var apiErrPlural string
    if strings.Contains(err.Error(), "error creating org") {
        // inspect embedded apiErr.Msg; retry with backoff for transient network errors
    }
    return err
}

Prevention

When it happens

Trigger: createOrg calls apiClient.CreateOrg(shared.CreateOrgRequest{...}) and the returned apiErr is non-nil — e.g. network failure, auth token expired/invalid, server-side validation rejecting the org name, or server error.

Common situations: No internet connection or proxy blocking the API host; expired session requiring re-login; duplicate/conflicting org name or permission denied on the server; Plandex server temporarily down.

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