{"record":{"id":"9987ae20735fed21","repo":"plandex-ai/plandex","slug":"error-prompting-for-sign-in-to-new-account-v","errorCode":null,"errorMessage":"error prompting for sign in to new account: %v","messagePattern":"error prompting for sign in to new account: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/auth/account.go","lineNumber":48,"sourceCode":"\tvar options []string\n\tfor _, account := range accounts {\n\t\toptions = append(options, fmt.Sprintf(\"<%s> %s\", account.UserName, account.Email))\n\t}\n\n\toptions = append(options, AddAccountOption)\n\n\t// either select from existing accounts or sign in/create account\n\n\tselectedOpt, err := term.SelectFromList(\"Select an account:\", options)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error selecting account: %v\", err)\n\t}\n\n\tif selectedOpt == AddAccountOption {\n\t\terr := promptSignInNewAccount()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error prompting for sign in to new account: %v\", err)\n\t\t}\n\t\treturn nil\n\t}\n\n\tvar selected *shared.ClientAccount\n\tfor i, opt := range options {\n\t\tif selectedOpt == opt {\n\t\t\tselected = accounts[i]\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif selected == nil {\n\t\treturn fmt.Errorf(\"error selecting account: account not found\")\n\t}\n\n\tselectedAuth := *selected\n","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/auth/account.go#L30-L66","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Before choosing Add another account, confirm you can complete sign-in interactively\nfunc canPrompt() bool {\n    fi, _ := os.Stdin.Stat()\n    return fi.Mode()&os.ModeCharDevice != 0\n}\n// and that the server is reachable\n// if err := checkServerReachable(serverURL); err != nil { return err }","typeGuard":"func isAddAccountPromptError(err error) bool {\n    return err != nil && strings.HasPrefix(err.Error(), \"error prompting for sign in to new account:\")\n}","tryCatchPattern":"if err := auth.SelectOrSignInOrCreate(); err != nil {\n    if isAddAccountPromptError(err) {\n        fmt.Fprintln(os.Stderr, \"adding account failed; verify credentials/server, then retry\")\n        os.Exit(1)\n    }\n    log.Fatal(err)\n}","preventionTips":["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"],"tags":["auth","sign-in","interactive","go"],"backgroundTag":"sign-in-flow-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"}