langfuse/langfuse · warning · Error
User with email already exists. Please sign in.
Error message
User with email already exists. Please sign in.
What it means
createUserEmailPassword checks for an existing user by lowercased email; if one exists it throws, with the message depending on whether the existing account has a password. Credentials-based accounts get 'User with email already exists. Please sign in.' while SSO-created accounts get the identity-provider message.
Source
Thrown at web/src/features/auth-credentials/lib/credentialsServerUtils.ts:35
password: string,
name: string,
options?: {
/** Ad-platform click ids, see getAdClickIdsFromRequest */
adClickIds?: AdClickIds;
},
) {
if (!isValidPassword(password))
throw new Error("Password needs to be at least 8 characters long.");
const hashedPassword = await hashPassword(password);
// check that no user exists with this email
const user = await prisma.user.findUnique({
where: {
email: email.toLowerCase(),
},
});
if (user !== null) {
throw new Error(
user.password !== null
? "User with email already exists. Please sign in."
: "You have already signed up via an identity provider. Please sign in.",
);
}
const newUser = await prisma.user.create({
data: {
email: email.toLowerCase(),
password: hashedPassword,
name,
},
});
await createProjectMembershipsOnSignup(newUser, {
userWasJustCreated: true,
adClickIds: options?.adClickIds,
});View on GitHub (pinned to 59d92c7cf3)
Solutions
- Sign in with the existing account instead (or use password reset if forgotten).
- On the client, catch this message and redirect to the sign-in flow.
- Guard against duplicate submission by disabling the submit button while in flight.
Example fix
// before
await createUserEmailPassword('existing@user.com', 'password123');
// after
const user = await prisma.user.findUnique({ where: { email } });
if (user) {
// route to sign-in / password reset instead of signup
return redirectToSignin();
}
await createUserEmailPassword(email, 'password123'); Defensive patterns
Strategy: validation
Validate before calling
const existing = await findUserByEmail(email);
if (existing) { /* route to sign-in or reset */ } Try / catch
try { await createUserEmailPassword(email, pwd); }
catch (e) {
if (e instanceof Error && e.message.includes('already exists')) return signIn(email, pwd);
throw e;
} Prevention
- Check for an existing account before offering signup.
- Disable submit buttons during the request to prevent duplicate signups.
When it happens
Trigger: Calling signup with an email that already registered with email/password (user.password !== null). Duplicate-tab signups, double form submissions, or retrying signup after a partial success.
Common situations: User already signed up previously and forgot; race where two signup requests with the same email land nearly simultaneously; testing signup with an already-used fixture email.
Related errors
- Password needs to be at least 8 characters long.
- eligibilityError
- Signup: Error creating user:
- Signup verify: Error creating user:
- Missing project ID
AI-assisted analysis of langfuse/langfuse@59d92c7cf3 (2026-08-27).
Data as JSON: /api/errors/0234b854bacea503.
Report an issue: GitHub.