makeplane/plane · warning · AuthenticationException

5092

5092

Error message

INVALID_MAGIC_CODE_SIGN_UP

What it means

Raised in MagicCodeProvider.set_user_data (magic_code.py:193) — the SIGN_UP counterpart of 55. Wrong code on verify, attempts not exhausted, and NO User exists for the email. Code 5092, payload {email}. Token remains valid for further attempts.

Source

Thrown at apps/api/plane/authentication/provider/credentials/magic_code.py:193

                        raise AuthenticationException(
                            error_code=AUTHENTICATION_ERROR_CODES["EMAIL_CODE_ATTEMPT_EXHAUSTED_SIGN_IN"],
                            error_message="EMAIL_CODE_ATTEMPT_EXHAUSTED_SIGN_IN",
                            payload={"email": str(email)},
                        )
                    raise AuthenticationException(
                        error_code=AUTHENTICATION_ERROR_CODES["EMAIL_CODE_ATTEMPT_EXHAUSTED_SIGN_UP"],
                        error_message="EMAIL_CODE_ATTEMPT_EXHAUSTED_SIGN_UP",
                        payload={"email": str(email)},
                    )

                if user_exists:
                    raise AuthenticationException(
                        error_code=AUTHENTICATION_ERROR_CODES["INVALID_MAGIC_CODE_SIGN_IN"],
                        error_message="INVALID_MAGIC_CODE_SIGN_IN",
                        payload={"email": str(email)},
                    )
                else:
                    raise AuthenticationException(
                        error_code=AUTHENTICATION_ERROR_CODES["INVALID_MAGIC_CODE_SIGN_UP"],
                        error_message="INVALID_MAGIC_CODE_SIGN_UP",
                        payload={"email": str(email)},
                    )
        else:
            email = str(self.key).replace("magic_", "", 1)
            if User.objects.filter(email=email).exists():
                raise AuthenticationException(
                    error_code=AUTHENTICATION_ERROR_CODES["EXPIRED_MAGIC_CODE_SIGN_IN"],
                    error_message="EXPIRED_MAGIC_CODE_SIGN_IN",
                    payload={"email": str(email)},
                )
            else:
                raise AuthenticationException(
                    error_code=AUTHENTICATION_ERROR_CODES["EXPIRED_MAGIC_CODE_SIGN_UP"],
                    error_message="EXPIRED_MAGIC_CODE_SIGN_UP",
                    payload={"email": str(email)},
                )

View on GitHub (pinned to 1c8a60f858)

Solutions

  1. Resubmit the correct 6-digit code from the latest email.
  2. Confirm the email used for signup is the one receiving the code.
  3. Regenerate a new code if the current one is ambiguous, but remember each regenerate counts toward the issue limit.

Example fix

// before: wrong code, unregistered email -> 5092
// after: enter the exact 6 digits from the newest signup email
Defensive patterns

Strategy: try-catch

Validate before calling

from plane.authentication.provider.credentials.magic_code import MagicCodeProvider
from plane.settings.redis import redis_instance

def verify_budget_remaining(token_key: str) -> int:
    ri = redis_instance()
    raw = ri.get(MagicCodeProvider._verify_attempts_key(token_key))
    used = int(raw) if raw else 0
    return max(MagicCodeProvider.MAX_VERIFY_ATTEMPTS - used, 0)

Try / catch

try:
    provider.set_user_data()
except AuthenticationException as e:
    if e.error_code == 5092:
        show_remaining_attempts_and_re_prompt(email=e.payload.get('email'))
    else:
        raise

Prevention

When it happens

Trigger: A valid token exists but the submitted code does not match; the verify counter is under the cap; the email is unregistered. AuthenticationException code 5092 is raised with the cleaned email.

Common situations: Signup with a mistyped code, stale code from a previous signup attempt, or an attacker guessing codes for an unknown email.

Related errors


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