plandex-ai/plandex · error
error signing in to new account: %v
Error message
error signing in to new account: %v
What it means
SelectOrSignInOrCreate in app/cli/auth/account.go wraps failures from promptSignInNewAccount() as 'error signing in to new account: %v'. This path runs when no existing accounts are stored, so the CLI immediately prompts for a fresh sign-in/sign-up; any failure inside that interactive flow (API error, invalid credentials, aborted prompt) is wrapped here.
Source
Thrown at app/cli/auth/account.go:24
shared "plandex-shared"
"github.com/fatih/color"
)
const AddAccountOption = "Add another account"
func SelectOrSignInOrCreate() error {
accounts, err := loadAccounts()
if err != nil {
return fmt.Errorf("error loading accounts: %v", err)
}
if len(accounts) == 0 {
err := promptSignInNewAccount()
if err != nil {
return fmt.Errorf("error signing in to new account: %v", err)
}
return nil
}
var options []string
for _, account := range accounts {
options = append(options, fmt.Sprintf("<%s> %s", account.UserName, account.Email))
}
options = append(options, AddAccountOption)
// either select from existing accounts or sign in/create account
selectedOpt, err := term.SelectFromList("Select an account:", options)
if err != nil {
return fmt.Errorf("error selecting account: %v", err)View on GitHub (pinned to e2d772072e)
Solutions
- Check the wrapped underlying error to distinguish network/API failures from user cancellation.
- Verify server connectivity and that the correct host/mode is configured (e.g. PLandex server URL or local mode).
- Re-run interactively in a real TTY — the prompt cannot complete in CI or with piped stdin.
- Confirm the email/verification code is correct and not expired; request a new code and retry.
Defensive patterns
Strategy: validation
Validate before calling
// Ensure the environment can complete an interactive sign-in before calling it
func canPrompt() error {
if fi, _ := os.Stdin.Stat(); fi.Mode()&os.ModeCharDevice == 0 {
return errors.New("stdin is not a TTY; interactive sign-in unavailable")
}
return nil
}
// also verify server reachability beforehand
if err := checkServerReachable(serverURL); err != nil {
return err
} Type guard
func isSignInError(err error) bool {
return err != nil && strings.HasPrefix(err.Error(), "error signing in to new account:")
} Try / catch
if err := auth.SelectOrSignInOrCreate(); err != nil {
if isSignInError(err) {
fmt.Fprintln(os.Stderr, "sign-in failed; check server connectivity and verification code, then retry")
os.Exit(1)
}
log.Fatal(err)
} Prevention
- Run sign-in only in an interactive TTY, never with piped stdin or in CI
- Verify server URL/connectivity before first-time setup
- Enter the verification code promptly before it expires
- Check that the email domain is allowed by the server
When it happens
Trigger: Calling SelectOrSignInOrCreate with len(accounts)==0 and promptSignInNewAccount() returning an error — failed email verification code, server API error during sign-in/sign-up, or the user aborting the interactive prompt.
Common situations: First-time setup against an unreachable or misconfigured server (local vs. hosted mode); invalid or expired verification code; server rejects the email domain; user cancels the prompt in a non-interactive terminal (CI, piped stdin).
Related errors
- error prompting for sign in to new account: %v
- error selecting account: %v
- error loading accounts: %v
- auth.Current.UserId is empty
- auth.Current.UserId is empty
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/83dfcf3e28f75d26.
Report an issue: GitHub.