{"record":{"id":"198ffbf114a5d554","repo":"makeplane/plane","slug":"5097","errorCode":"5097","errorMessage":"EXPIRED_MAGIC_CODE_SIGN_UP","messagePattern":"EXPIRED_MAGIC_CODE_SIGN_UP","errorType":"exception","errorClass":"AuthenticationException","httpStatus":null,"severity":"warning","filePath":"apps/api/plane/authentication/provider/credentials/magic_code.py","lineNumber":207,"sourceCode":"                        error_message=\"INVALID_MAGIC_CODE_SIGN_IN\",\n                        payload={\"email\": str(email)},\n                    )\n                else:\n                    raise AuthenticationException(\n                        error_code=AUTHENTICATION_ERROR_CODES[\"INVALID_MAGIC_CODE_SIGN_UP\"],\n                        error_message=\"INVALID_MAGIC_CODE_SIGN_UP\",\n                        payload={\"email\": str(email)},\n                    )\n        else:\n            email = str(self.key).replace(\"magic_\", \"\", 1)\n            if User.objects.filter(email=email).exists():\n                raise AuthenticationException(\n                    error_code=AUTHENTICATION_ERROR_CODES[\"EXPIRED_MAGIC_CODE_SIGN_IN\"],\n                    error_message=\"EXPIRED_MAGIC_CODE_SIGN_IN\",\n                    payload={\"email\": str(email)},\n                )\n            else:\n                raise AuthenticationException(\n                    error_code=AUTHENTICATION_ERROR_CODES[\"EXPIRED_MAGIC_CODE_SIGN_UP\"],\n                    error_message=\"EXPIRED_MAGIC_CODE_SIGN_UP\",\n                    payload={\"email\": str(email)},\n                )\n","sourceCodeStart":189,"sourceCodeEnd":212,"githubUrl":"https://github.com/makeplane/plane/blob/1c8a60f858d8472aa56e29994ec1c7926da2c6ce/apps/api/plane/authentication/provider/credentials/magic_code.py#L189-L212","documentation":"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}.","triggerScenarios":"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.","commonSituations":"Signup code expired before use, code already consumed by a successful signup, Redis flush, or verifying a code from a superseded signup request.","solutions":["Start a fresh signup: request a new code and verify within 600s.","Confirm the email is correct and capable of receiving mail (EMAIL_HOST configured).","Check Redis health/eviction if keys vanish prematurely."],"exampleFix":"// before: verify with expired/missing token, unregistered email -> 5097\n// after: regenerate signup code, verify promptly","handlingStrategy":"validation","validationCode":"from plane.settings.redis import redis_instance\n\ndef token_still_valid(token_key: str) -> bool:\n    ri = redis_instance()\n    return bool(ri.exists(token_key)) and (ri.ttl(token_key) > 0)","typeGuard":null,"tryCatchPattern":"try:\n    provider.set_user_data()\nexcept AuthenticationException as e:\n    if e.error_code == 5097:\n        provider.initiate()  # restart the signup with a fresh code\n    else:\n        raise","preventionTips":["Start the signup fresh and verify promptly.","Confirm the email can receive mail before relying on the code."],"tags":["authentication","magic-code","expired","redis","signup"],"backgroundTag":null,"analyzedSha":"1c8a60f858d8472aa56e29994ec1c7926da2c6ce","analyzedAt":"2026-08-12T14:44:31.636Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}