{"record":{"id":"5be7c8134e66af9c","repo":"plandex-ai/plandex","slug":"error-creating-org-v","errorCode":null,"errorMessage":"error creating org: %v","messagePattern":"error creating org: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/auth/org.go","lineNumber":84,"sourceCode":"\t\treturn nil, fmt.Errorf(\"error prompting org name: %v\", err)\n\t}\n\n\tif !isLocalMode {\n\t\tautoAddDomainUsers, err = promptAutoAddUsersIfValid(Current.Email)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error prompting auto add domain users: %v\", err)\n\t\t}\n\t}\n\n\tterm.StartSpinner(\"\")\n\tres, apiErr := apiClient.CreateOrg(shared.CreateOrgRequest{\n\t\tName:               name,\n\t\tAutoAddDomainUsers: autoAddDomainUsers,\n\t})\n\tterm.StopSpinner()\n\n\tif apiErr != nil {\n\t\treturn nil, fmt.Errorf(\"error creating org: %v\", apiErr.Msg)\n\t}\n\n\treturn &shared.Org{Id: res.Id, Name: name}, nil\n}\n\nfunc promptAutoAddUsersIfValid(email string) (bool, error) {\n\tuserDomain := strings.Split(email, \"@\")[1]\n\tvar autoAddDomainUsers bool\n\tvar err error\n\tif !shared.IsEmailServiceDomain(userDomain) {\n\t\tfmt.Println(\"With domain auto-join, you can allow any user with an email ending in @\"+userDomain, \"to auto-join this org.\")\n\t\tautoAddDomainUsers, err = term.ConfirmYesNo(fmt.Sprintf(\"Enable auto-join for %s?\", userDomain))\n\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t}\n\treturn autoAddDomainUsers, nil","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/auth/org.go#L66-L102","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check network connectivity and that the Plandex API server is reachable","Re-authenticate (sign in again) if the auth token may have expired","Retry org creation; read the embedded apiErr.Msg for the server's specific reason","If the server rejects the name or permissions, choose a different org name or contact an org admin"],"exampleFix":"// before\n$ plandex-cli create-org\nerror creating org: unauthorized\n// after\n$ plandex-cli sign-in   # refresh auth\n$ plandex-cli create-org","handlingStrategy":"retry","validationCode":"// pre-flight connectivity check to the API host before creating an org\nresp, err := http.Get(apiBaseURL + \"/health\")\nif err != nil {\n    return fmt.Errorf(\"API unreachable, fix network before creating org: %v\", err)\n}","typeGuard":null,"tryCatchPattern":"org, err := createOrg(false)\nif err != nil {\n    var apiErrPlural string\n    if strings.Contains(err.Error(), \"error creating org\") {\n        // inspect embedded apiErr.Msg; retry with backoff for transient network errors\n    }\n    return err\n}","preventionTips":["Check connectivity/VPN/proxy before org operations","Re-authenticate when tokens may have expired","Read the embedded server message for the exact rejection reason","Retry transient failures with exponential backoff"],"tags":["api","network","org-creation"],"backgroundTag":"api-request-failed","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}