makeplane/plane · error · AuthenticationException

5030

5030

Error message

USER_ALREADY_EXIST

What it means

Raised in EmailProvider.set_user_data (email.py:45) during signup when User.objects.filter(email=self.key).exists() is True. It prevents creating a duplicate account for an email that is already registered, with code 5030. Note: this path only runs when is_signup is True.

Source

Thrown at apps/api/plane/authentication/provider/credentials/email.py:45

        (ENABLE_EMAIL_PASSWORD,) = get_configuration_value([
            {
                "key": "ENABLE_EMAIL_PASSWORD",
                "default": os.environ.get("ENABLE_EMAIL_PASSWORD"),
            }
        ])

        if ENABLE_EMAIL_PASSWORD == "0":
            raise AuthenticationException(
                error_code=AUTHENTICATION_ERROR_CODES["EMAIL_PASSWORD_AUTHENTICATION_DISABLED"],
                error_message="EMAIL_PASSWORD_AUTHENTICATION_DISABLED",
            )

    def set_user_data(self):
        if self.is_signup:
            # Check if the user already exists
            if User.objects.filter(email=self.key).exists():
                self.logger.warning("User already exists")
                raise AuthenticationException(
                    error_message="USER_ALREADY_EXIST",
                    error_code=AUTHENTICATION_ERROR_CODES["USER_ALREADY_EXIST"],
                )

            super().set_user_data({
                "email": self.key,
                "user": {
                    "avatar": "",
                    "first_name": "",
                    "last_name": "",
                    "provider_id": "",
                    "is_password_autoset": False,
                },
            })
            return
        else:
            user = User.objects.filter(email=self.key).first()

View on GitHub (pinned to 1c8a60f858)

Solutions

  1. Redirect the user to the sign-in flow — they already have an account.
  2. If the intent is password reset, use the reset-password flow rather than re-signing up.
  3. Check for case-variant duplicates in the User table if the email 'looks' new to the user.

Example fix

// before: POST /api/users/me/  (signup) with existing email -> 5030
// after: POST to the sign-in endpoint instead, or trigger password reset
Defensive patterns

Strategy: validation

Validate before calling

from plane.db.models import User

def can_signup(email: str) -> bool:
    return not User.objects.filter(email=email).exists()

Try / catch

try:
    provider.set_user_data()
except AuthenticationException as e:
    if e.error_code == 5030:
        redirect_to_signin(email)
    else:
        raise

Prevention

When it happens

Trigger: Calling the sign-up flow (is_signup=True) with an email that already has a User row triggers the warning log 'User already exists' and AuthenticationException code 5030. The duplicate check is a direct existence query before any user creation.

Common situations: User who already registered tries to sign up again instead of signing in; a script reposts the signup form; case-sensitivity quirks where the stored email differs only in case (depends on DB collation).

Related errors


AI-assisted analysis of makeplane/plane@1c8a60f858 (2026-08-12). Data as JSON: /api/errors/2ee330a984c5d170. Report an issue: GitHub.