makeplane/plane · warning · AuthenticationException

5097

5097

Error message

EXPIRED_MAGIC_CODE_SIGN_UP

What it means

Raised in MagicCodeProvider.set_user_data (magic_code.py:207) — the SIGN_UP counterpart of 57. The Redis key is absent/expired and NO User exists for the email. Code 5097, payload {email}.

Source

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

                        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. Start a fresh signup: request a new code and verify within 600s.
  2. Confirm the email is correct and capable of receiving mail (EMAIL_HOST configured).
  3. Check Redis health/eviction if keys vanish prematurely.

Example fix

// before: verify with expired/missing token, unregistered email -> 5097
// after: regenerate signup code, verify promptly
Defensive patterns

Strategy: validation

Validate before calling

from plane.settings.redis import redis_instance

def token_still_valid(token_key: str) -> bool:
    ri = redis_instance()
    return bool(ri.exists(token_key)) and (ri.ttl(token_key) > 0)

Try / catch

try:
    provider.set_user_data()
except AuthenticationException as e:
    if e.error_code == 5097:
        provider.initiate()  # restart the signup with a fresh code
    else:
        raise

Prevention

When it happens

Trigger: Verify is called but the token key is missing in Redis (expired/consumed/flushed) and the email is unregistered. AuthenticationException code 5097 is raised as the SIGN_UP variant.

Common situations: Signup code expired before use, code already consumed by a successful signup, Redis flush, or verifying a code from a superseded signup request.

Related errors


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