makeplane/plane · error · CommandError

User Email is required

Error message

User Email is required

What it means

Raised by `create_project_member` when `--user_email` is missing or falsy (lines 32-33). `--user_email` uses `nargs="?"` so argparse leaves it `None` and this check is reachable. Swallowed by the command's own `except CommandError` (lines 70-71).

Source

Thrown at apps/api/plane/db/management/commands/create_project_member.py:33

    ProjectUserProperty,
)


class Command(BaseCommand):
    help = "Add a member to a project. If present in the workspace"

    def add_arguments(self, parser):
        # Positional argument
        parser.add_argument("--project_id", type=str, nargs="?", help="Project ID")
        parser.add_argument("--user_email", type=str, nargs="?", help="User Email")
        parser.add_argument("--role", type=int, nargs="?", help="Role of the user in the project")

    def handle(self, *args: Any, **options: Any):
        try:
            if not options["project_id"]:
                raise CommandError("Project ID is required")
            if not options["user_email"]:
                raise CommandError("User Email is required")

            project_id = options["project_id"]
            user_email = options["user_email"]
            role = options.get("role", 20)

            print(f"Role: {role}")

            user = User.objects.filter(email=user_email).first()
            if not user:
                raise CommandError("User not found")

            # Check if the project exists
            project = Project.objects.filter(pk=project_id).first()
            if not project:
                raise CommandError("Project not found")

            # Check if the user exists in the workspace
            if not WorkspaceMember.objects.filter(workspace=project.workspace, member=user, is_active=True).exists():

View on GitHub (pinned to 1c8a60f858)

Solutions

  1. Provide the flag: `python manage.py create_project_member --project_id <uuid> --user_email user@example.com`
  2. Confirm the email is registered before running (see [87]).

Example fix

# before
python manage.py create_project_member --project_id <uuid>
# after
python manage.py create_project_member --project_id <uuid> --user_email user@example.com
Defensive patterns

Strategy: validation

Validate before calling

import sys
user_email = ''  # from your script
if not user_email:
    sys.exit('--user_email is required')

Type guard

def has_user_email(value) -> bool:
    return isinstance(value, str) and '@' in value and len(value) > 3

Try / catch

# Command swallows its own CommandError to stdout and returns 0;
# validate the email is present and registered before running.

Prevention

When it happens

Trigger: Running the command without `--user_email`, or with `--user_email ''`.

Common situations: Omitted flag; placeholder empty string in a templated script.

Related errors


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