plandex-ai/plandex · error · http
Error signing in:
Error message
Error signing in:
What it means
SignInHandler reports HTTP 500 when ValidateAndSignIn (app/server/handlers/sessions.go:231-236) returns an error. This wraps any failure of the sign-in pipeline itself: credential checks, user lookup, or token/cookie issuance inside that function. Unlike the unmarshal errors, this is a server-side authentication/business-logic failure.
Source
Thrown at app/server/handlers/sessions.go:235
log.Printf("Error reading request body: %v\n", err)
http.Error(w, "Error reading request body: "+err.Error(), http.StatusInternalServerError)
return
}
var req shared.SignInRequest
err = json.Unmarshal(body, &req)
if err != nil {
log.Printf("Error unmarshalling request: %v\n", err)
http.Error(w, "Error unmarshalling request: "+err.Error(), http.StatusInternalServerError)
return
}
log.Println("Validating and signing in")
resp, err := ValidateAndSignIn(w, r, req)
if err != nil {
log.Printf("Error signing in: %v\n", err)
http.Error(w, "Error signing in: "+err.Error(), http.StatusInternalServerError)
return
}
bytes, err := json.Marshal(resp)
if err != nil {
log.Printf("Error marshalling response: %v\n", err)
http.Error(w, "Error marshalling response: "+err.Error(), http.StatusInternalServerError)
return
}
log.Println("Successfully signed in")
w.Write(bytes)
}
func SignOutHandler(w http.ResponseWriter, r *http.Request) {
log.Println("Received request for SignOutHandler")View on GitHub (pinned to e2d772072e)
Solutions
- Inspect the server log line 'Error signing in: ...' to see the wrapped error from ValidateAndSignIn and identify which stage failed
- If it is a credential failure, return 401 instead of 500 so clients can distinguish bad credentials from server faults
- Verify the database is reachable and the users/auth_tokens tables exist and are migrated
- Confirm password hashing parameters match those used when the hash was stored
Example fix
// before
http.Error(w, "Error signing in: "+err.Error(), http.StatusInternalServerError)
// after
if errors.Is(err, ErrInvalidCredentials) {
http.Error(w, "Invalid email or password", http.StatusUnauthorized)
return
}
http.Error(w, "Error signing in: "+err.Error(), http.StatusInternalServerError) Defensive patterns
Strategy: try-catch
Validate before calling
// client-side pre-check: require non-empty credentials before calling
if email == "" || password == "" {
return errors.New("email and password are required")
} Type guard
func isAuthError(resp *http.Response) bool {
return resp.StatusCode == http.StatusUnauthorized || resp.StatusCode == http.StatusInternalServerError
} Try / catch
resp, err := client.Do(req)
body, _ := io.ReadAll(resp.Body)
if resp.StatusCode != http.StatusOK {
if strings.HasPrefix(string(body), "Error signing in") {
return fmt.Errorf("sign-in failed server-side: %s", string(body))
}
return fmt.Errorf("unexpected status %d", resp.StatusCode)
} Prevention
- Verify credentials are correct before assuming a server fault
- Confirm account is active and not deleted/reset
- Monitor DB connectivity; most 500s here are database failures, not bad passwords
- Retry with exponential backoff only for transport errors, never for credential errors
When it happens
Trigger: Calling the sign-in endpoint with credentials that fail validation in ValidateAndSignIn: unknown email, wrong password/hash mismatch, disabled or deleted account, or a database error while fetching the user or creating the auth token/session cookie.
Common situations: Users mistyping passwords, accounts deleted or passwords reset out-of-band, database connectivity problems, or bcrypt/argon2 verification configured with different parameters than were used at signup.
Related errors
- error signing in to new account: %v
- error prompting for sign in to new account: %v
- token exchange failed - error creating request: %s
- token exchange failed - error reading body: %s
- token exchange failed - status: %d, body: %s
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/681a7f619502aca9.
Report an issue: GitHub.