{"record":{"id":"1f0c441a42ad5419","repo":"plandex-ai/plandex","slug":"error-creating-account-v","errorCode":null,"errorMessage":"error creating account: %v","messagePattern":"error creating account: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/auth/account.go","lineNumber":190,"sourceCode":"\tif err != nil {\n\t\treturn fmt.Errorf(\"error prompting email: %v\", err)\n\t}\n\n\tres, err := verifyEmail(email, host)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error verifying email: %v\", err)\n\t}\n\n\tif res.hasAccount {\n\t\terr := signIn(email, res.pin, host)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error signing in: %v\", err)\n\t\t}\n\t} else {\n\t\terr := createAccount(email, res.pin, host, res.isLocalMode)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error creating account: %v\", err)\n\t\t}\n\t}\n\n\tif !term.IsRepl {\n\t\tterm.PrintCmds(\"\", \"\")\n\t}\n\n\treturn nil\n}\n\ntype verifyEmailRes struct {\n\thasAccount  bool\n\tisLocalMode bool\n\tpin         string\n}\n\nfunc verifyEmail(email, host string) (*verifyEmailRes, error) {\n\tterm.StartSpinner(\"\")","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/auth/account.go#L172-L208","documentation":"When verifyEmail reports no existing account (res.hasAccount == false), promptSignInNewAccount calls createAccount(email, res.pin, host, res.isLocalMode); failure is wrapped as 'error creating account: %v'. It means the server refused the account-creation request for the supplied email/pin.","triggerScenarios":"createAccount's API call fails: invalid or expired verification pin, the email was actually registered between verification and creation, server-side validation rejects the email, or host/network errors.","commonSituations":"Expired pin while the user hesitates at account creation; user previously signed up with the same email so the server now rejects creation; self-hosted server with restrictions on new accounts; stale server state after a local DB reset.","solutions":["If the email may already exist, re-run the flow — verifyEmail will then route to sign-in instead of createAccount.","Restart the sign-in flow to get a fresh pin and complete creation within its validity window.","Check the nested server message for the specific rejection (duplicate email, invalid pin, validation) and address it.","Verify the host/server is the intended one (local vs cloud) to avoid state mismatch."],"exampleFix":"// before: account already exists, creation rejected\nplandex auth -> createAccount(user@example.com) -> duplicate email error\n// after: existing accounts sign in via the verification path instead\nplandex auth  # verifyEmail reports hasAccount -> signIn path","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := createAccount(email, pin, host, isLocalMode); err != nil {\n    // account may already exist: re-run verifyEmail so hasAccount routes to signIn instead\n    return fmt.Errorf(\"account creation failed (%v); re-run auth — existing accounts are routed to sign-in\", err)\n}","preventionTips":["If unsure whether the account exists, just re-run the auth flow — verifyEmail picks the right path.","Complete creation promptly; the pin from verification expires in 5 minutes.","Check the server message for duplicate-email rejections before assuming a bug.","Keep host/deployment consistent (local vs cloud) to avoid split account state."],"tags":["auth","account-creation","cli","api"],"backgroundTag":"account-creation-rejected","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"}