makeplane/plane · error · CommandError

User with the provided email does not exist.

Error message

User with the provided email does not exist.

What it means

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`.

Source

Thrown at apps/api/plane/db/management/commands/create_instance_admin.py:28

from plane.db.models import User


class Command(BaseCommand):
    help = "Add a new instance admin"

    def add_arguments(self, parser):
        # Positional argument
        parser.add_argument("admin_email", type=str, help="Instance Admin Email")

    def handle(self, *args, **options):
        admin_email = options.get("admin_email", False)

        if not admin_email:
            raise CommandError("Please provide the email of the admin.")

        user = User.objects.filter(email=admin_email).first()
        if user is None:
            raise CommandError("User with the provided email does not exist.")

        try:
            # Get the instance
            instance = Instance.objects.last()

            # Get or create an instance admin
            _, created = InstanceAdmin.objects.get_or_create(user=user, instance=instance, role=20)

            if not created:
                raise CommandError("The provided email is already an instance admin.")

            self.stdout.write(self.style.SUCCESS("Successfully created the admin"))
        except Exception as e:
            print(e)
            raise CommandError("Failed to create the instance admin.")

View on GitHub (pinned to 1c8a60f858)

Solutions

  1. List candidate users: `python manage.py shell -c "from plane.db.models import User; print(list(User.objects.values_list('email', flat=True)))"`
  2. Match the exact stored casing of the email when invoking the command.
  3. Have the user register/sign in first to create their `User` record.

Example fix

# before
python manage.py create_instance_admin Admin@Example.com   # wrong case / no such user
# after
python manage.py create_instance_admin admin@example.com   # exact stored email
Defensive patterns

Strategy: validation

Validate before calling

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)"

Type guard

def user_exists(email: str) -> bool:
    from plane.db.models import User
    return User.objects.filter(email=email).exists()

Try / catch

from django.core.management.base import CommandError
try:
    call_command('create_instance_admin', admin_email=email)
except CommandError as e:
    if 'does not exist' in str(e):
        # user not found — register them first
        ...

Prevention

When it happens

Trigger: Running `python manage.py create_instance_admin nonexistent@example.com` where no `User` row has that email (exact match, case-sensitive on the filter).

Common situations: 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).

Related errors


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