plandex-ai/plandex · error
error prompting for sign in to new account: %v
Error message
error prompting for sign in to new account: %v
What it means
SelectOrSignInOrCreate in app/cli/auth/account.go wraps failures from promptSignInNewAccount() as 'error prompting for sign in to new account: %v' when the user explicitly chose the 'Add another account' option from the selection list. Functionally it is the same sign-in flow as the no-accounts case, but triggered from the add-account branch; any failure in the sign-in/sign-up prompt is wrapped here.
Source
Thrown at app/cli/auth/account.go:48
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)
}
if selectedOpt == AddAccountOption {
err := promptSignInNewAccount()
if err != nil {
return fmt.Errorf("error prompting for sign in to new account: %v", err)
}
return nil
}
var selected *shared.ClientAccount
for i, opt := range options {
if selectedOpt == opt {
selected = accounts[i]
break
}
}
if selected == nil {
return fmt.Errorf("error selecting account: account not found")
}
selectedAuth := *selected
View on GitHub (pinned to e2d772072e)
Solutions
- Read the wrapped cause to distinguish network/API errors from prompt cancellation.
- Verify server connectivity and account credentials; request a fresh verification code if it expired.
- Re-run in an interactive TTY; the add-account prompt cannot complete with piped stdin or in CI.
- If the new email already exists as an account, select the existing account instead of adding a duplicate.
Defensive patterns
Strategy: try-catch
Validate before calling
// Before choosing Add another account, confirm you can complete sign-in interactively
func canPrompt() bool {
fi, _ := os.Stdin.Stat()
return fi.Mode()&os.ModeCharDevice != 0
}
// and that the server is reachable
// if err := checkServerReachable(serverURL); err != nil { return err } Type guard
func isAddAccountPromptError(err error) bool {
return err != nil && strings.HasPrefix(err.Error(), "error prompting for sign in to new account:")
} Try / catch
if err := auth.SelectOrSignInOrCreate(); err != nil {
if isAddAccountPromptError(err) {
fmt.Fprintln(os.Stderr, "adding account failed; verify credentials/server, then retry")
os.Exit(1)
}
log.Fatal(err)
} Prevention
- Add accounts from an interactive TTY, not CI or piped stdin
- Verify server connectivity before adding a new account
- If the email already exists, select the existing account rather than re-adding it
- Request a fresh verification code if the previous one expired
When it happens
Trigger: User selects AddAccountOption in the account list, then promptSignInNewAccount() fails — API error creating/signing in the new account, invalid credentials or verification code, or aborted interactive prompt.
Common situations: Adding a second account while the server is unreachable; using an email already registered with different credentials; expired verification code; running non-interactively so the prompt cannot be answered.
Related errors
- error signing 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/9987ae20735fed21.
Report an issue: GitHub.