makeplane/plane · error · CommandError

Please provide the email of the admin.

Error message

Please provide the email of the admin.

What it means

Raised by `create_instance_admin` when `options['admin_email']` is falsy (line 23). Because `admin_email` is declared as a required positional argument (line 18), argparse rejects a missing value before `handle()` runs, so this branch is effectively only reachable when the command is invoked programmatically (e.g. `call_command`) with a falsy value. It is a defensive guard, not a normal CLI path.

Source

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

from django.core.management.base import BaseCommand, CommandError

# Module imports
from plane.license.models import Instance, InstanceAdmin
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)

View on GitHub (pinned to 1c8a60f858)

Solutions

  1. Invoke via the CLI: `python manage.py create_instance_admin admin@example.com` so argparse enforces presence.
  2. If calling programmatically, pass a non-empty string for `admin_email`.
  3. Add a pre-check in your wrapper: `if not admin_email: raise ValueError(...)` before calling.

Example fix

# before
call_command('create_instance_admin', admin_email='')
# after
call_command('create_instance_admin', admin_email='admin@example.com')
Defensive patterns

Strategy: validation

Validate before calling

import sys
admin_email = ''  # sourced from your script/env
if not admin_email:
    sys.exit('admin_email is required')
# then: call_command('create_instance_admin', admin_email=admin_email)

Type guard

def is_non_empty_email(value) -> bool:
    return isinstance(value, str) and bool(value.strip()) and '@' in value

Try / catch

from django.core.management import call_command
from django.core.management.base import CommandError
try:
    call_command('create_instance_admin', admin_email=admin_email)
except CommandError as e:
    # handle (note: argparse still rejects missing positional before this)
    ...

Prevention

When it happens

Trigger: Calling `call_command('create_instance_admin', admin_email=None)` or `admin_email=''` from Python code; otherwise argparse blocks invocation with the standard 'the following arguments are required' message.

Common situations: Custom orchestration scripts or tests that bypass argparse and pass an empty/None admin_email into `call_command`.

Related errors


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