{"record":{"id":"afe7d85efbb88b19","repo":"makeplane/plane","slug":"user-with-the-provided-email-does-not-exist","errorCode":null,"errorMessage":"User with the provided email does not exist.","messagePattern":"User with the provided email does not exist\\.","errorType":"exception","errorClass":"CommandError","httpStatus":null,"severity":"error","filePath":"apps/api/plane/db/management/commands/create_instance_admin.py","lineNumber":28,"sourceCode":"from plane.db.models import User\n\n\nclass Command(BaseCommand):\n    help = \"Add a new instance admin\"\n\n    def add_arguments(self, parser):\n        # Positional argument\n        parser.add_argument(\"admin_email\", type=str, help=\"Instance Admin Email\")\n\n    def handle(self, *args, **options):\n        admin_email = options.get(\"admin_email\", False)\n\n        if not admin_email:\n            raise CommandError(\"Please provide the email of the admin.\")\n\n        user = User.objects.filter(email=admin_email).first()\n        if user is None:\n            raise CommandError(\"User with the provided email does not exist.\")\n\n        try:\n            # Get the instance\n            instance = Instance.objects.last()\n\n            # Get or create an instance admin\n            _, created = InstanceAdmin.objects.get_or_create(user=user, instance=instance, role=20)\n\n            if not created:\n                raise CommandError(\"The provided email is already an instance admin.\")\n\n            self.stdout.write(self.style.SUCCESS(\"Successfully created the admin\"))\n        except Exception as e:\n            print(e)\n            raise CommandError(\"Failed to create the instance admin.\")\n","sourceCodeStart":10,"sourceCodeEnd":44,"githubUrl":"https://github.com/makeplane/plane/blob/1c8a60f858d8472aa56e29994ec1c7926da2c6ce/apps/api/plane/db/management/commands/create_instance_admin.py#L10-L44","documentation":"Raised by `create_instance_admin` when `User.objects.filter(email=admin_email).first()` returns `None` (lines 26-28). The provided email does not correspond to any registered Plane user, so it cannot be promoted to instance admin. This check runs before the `try` block, so it propagates as a true `CommandError`.","triggerScenarios":"Running `python manage.py create_instance_admin nonexistent@example.com` where no `User` row has that email (exact match, case-sensitive on the filter).","commonSituations":"Typo in the email; user has not yet signed up; email stored in a different case (the command does not lowercase the argument, unlike other commands).","solutions":["List candidate users: `python manage.py shell -c \"from plane.db.models import User; print(list(User.objects.values_list('email', flat=True)))\"`","Match the exact stored casing of the email when invoking the command.","Have the user register/sign in first to create their `User` record."],"exampleFix":"# before\npython manage.py create_instance_admin Admin@Example.com   # wrong case / no such user\n# after\npython manage.py create_instance_admin admin@example.com   # exact stored email","handlingStrategy":"validation","validationCode":"python manage.py shell -c \"from plane.db.models import User; import sys; sys.exit(0 if User.objects.filter(email='admin@example.com').exists() else 1)\"","typeGuard":"def user_exists(email: str) -> bool:\n    from plane.db.models import User\n    return User.objects.filter(email=email).exists()","tryCatchPattern":"from django.core.management.base import CommandError\ntry:\n    call_command('create_instance_admin', admin_email=email)\nexcept CommandError as e:\n    if 'does not exist' in str(e):\n        # user not found — register them first\n        ...","preventionTips":["Confirm the user has signed in at least once.","Match the exact stored (lowercased) email.","List users via the shell pre-check before promoting."],"tags":["django","management-command","validation","user-not-found","plane"],"backgroundTag":null,"analyzedSha":"1c8a60f858d8472aa56e29994ec1c7926da2c6ce","analyzedAt":"2026-08-12T14:44:31.636Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}