{"record":{"id":"4c269c688627f17e","repo":"plandex-ai/plandex","slug":"error-prompting-no-orgs-v","errorCode":null,"errorMessage":"error prompting no orgs: %v","messagePattern":"error prompting no orgs: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/auth/org.go","lineNumber":23,"sourceCode":"\t\"plandex-cli/term\"\n\t\"strings\"\n\n\tshared \"plandex-shared\"\n)\n\nfunc resolveOrgAuth(orgs []*shared.Org, isLocalMode bool) (*shared.Org, error) {\n\tvar org *shared.Org\n\tvar err error\n\n\tif len(orgs) == 0 {\n\t\tif isLocalMode {\n\t\t\torg, err = createOrg(isLocalMode)\n\t\t} else {\n\t\t\torg, err = promptNoOrgs()\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error prompting no orgs: %v\", err)\n\t\t}\n\n\t} else if len(orgs) == 1 {\n\t\torg = orgs[0]\n\t} else {\n\t\torg, err = selectOrg(orgs, isLocalMode)\n\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error selecting org: %v\", err)\n\t\t}\n\t}\n\n\treturn org, nil\n}\n\nfunc promptNoOrgs() (*shared.Org, error) {\n\tfmt.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.\")\n","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/auth/org.go#L5-L41","documentation":"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.","triggerScenarios":"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).","commonSituations":"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).","solutions":["Run the command in an interactive terminal so the confirm prompt can read stdin","Ask the org admin to invite your user or enable email-domain access, then re-run","Create an org in advance (web UI or local-mode auto-creation) so orgs is non-empty","Check the wrapped inner error — if it's an API error, verify server-side org creation permissions"],"exampleFix":"// before\nCI run: plandex command -> ConfirmYesNo reads EOF -> error prompting no orgs\n// after\n# pre-create org interactively once, or run locally with an org attached\nplandex sign in && plandex orgs # then run command in CI","handlingStrategy":"validation","validationCode":"orgs, err := auth.ListOrgsSafe() // or apiClient.ListOrgs()\nif err == nil && len(orgs) == 0 && !isTTY(os.Stdin) {\n\treturn fmt.Errorf(\"no orgs and no TTY to prompt; create/join an org first\")\n}","typeGuard":"func canPromptNoOrgs(interactive bool) bool { return interactive && term.IsTerminal(os.Stdin.Fd()) }","tryCatchPattern":"org, err := resolveOrgAuth(orgs, isLocalMode)\nif err != nil {\n\tif strings.Contains(err.Error(), \"prompting no orgs\") {\n\t\t// non-interactive or API failure: instruct user to join/create an org\n\t\tfmt.Fprintln(os.Stderr, \"Join or create an org first (ask an admin or use local mode).\", err)\n\t\tos.Exit(1)\n\t}\n\treturn err\n}","preventionTips":["Ensure an admin invites the user or enables email-domain access before first run","Run interactive onboarding in a real TTY, not CI","Use local mode where auto-org-creation is desired","Pre-create an org via web UI so the empty-org path never runs"],"tags":["org","interactive-prompt","tty"],"backgroundTag":"non-interactive-terminal","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}