plandex-ai/plandex · error
error signing in: %v
Error message
error signing in: %v
What it means
SignInWithCode wraps any ApiError returned by apiClient.SignIn (called with IsSignInCode=true) into 'error signing in: <server msg>'. It means the server rejected the pin-based sign-in-code exchange for the given host — the CLI reached the API but the API refused the sign-in. The underlying apiErr.Msg from the server is appended so the real cause is visible.
Source
Thrown at app/cli/auth/account.go:122
fmt.Println()
if !term.IsRepl {
term.PrintCmds("", "")
}
return nil
}
func SignInWithCode(code, host string) error {
term.StartSpinner("")
res, apiErr := apiClient.SignIn(shared.SignInRequest{
Pin: code,
IsSignInCode: true,
}, host)
term.StopSpinner()
if apiErr != nil {
return fmt.Errorf("error signing in: %v", apiErr.Msg)
}
return handleSignInResponse(res, host)
}
func promptInitialAuth() error {
fmt.Println("👋 Hey there!\nIt looks like this is your first time using Plandex on this computer.")
err := SelectOrSignInOrCreate()
if err != nil {
return fmt.Errorf("error selecting or signing in to account: %v", err)
}
return nil
}
const (View on GitHub (pinned to e2d772072e)
Solutions
- Read the appended apiErr.Msg — fix the specific server-reported cause (e.g. invalid or expired code).
- Request a fresh sign-in code and retry the command promptly before it expires.
- Verify the host matches the server that issued the code (check PLANDEX_HOST / configured host).
- Check that the Plandex server is running and reachable at the host; retry after confirming server health.
Example fix
// before: reusing an old code captured from an earlier email plandex auth sign-in-with-code OLD_CODE // after: request a fresh code and use it immediately plandex auth sign-in-with-code $(plandex auth request-code --email user@example.com)
Defensive patterns
Strategy: retry
Try / catch
err := auth.SignInWithCode(code, host)
if err != nil {
if strings.Contains(err.Error(), "expired") || strings.Contains(err.Error(), "invalid") {
code = requestNewSignInCode() // fetch a fresh code, then retry once
err = auth.SignInWithCode(code, host)
}
if err != nil { return fmt.Errorf("sign-in failed: %w", err) }
} Prevention
- Use the sign-in code immediately after receiving it; codes are short-lived.
- Keep the host consistent between code issuance and redemption (same PLANDEX_HOST).
- Check server health/reachability before starting the auth flow.
- Log apiErr.Msg upstream so the server's rejection reason is not lost.
When it happens
Trigger: apiClient.SignIn(shared.SignInRequest{Pin: code, IsSignInCode: true}, host) returns a non-nil apiErr: expired/invalid sign-in code, wrong or unreachable host, revoked pin, or server-side auth rejection during the code-based sign-in flow.
Common situations: User takes longer than the code's validity window to run the sign-in-with-code command; the code was already consumed; the CLI points at a different host (e.g. staging vs production) than the one that issued the code; the Plandex server was restarted with a fresh local-mode database invalidating issued codes.
Related errors
- error listing orgs: %v
- error verifying email: %v
- error creating account: %v
- error creating email verification: %v
- error listing contexts: %v
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/c413dfe9796375f1.
Report an issue: GitHub.