makeplane/plane · error · CommandError

Error: Email is required

Error message

Error: Email is required

What it means

Raised by `reactivate_workspace_member` when `email` is empty after `.strip().lower()` (lines 25-35). `email` is a required positional argument (line 18), so argparse enforces presence; this branch is reachable only via programmatic invocation with a whitespace-only value. Clean non-zero CommandError (no swallowing try/except in this command).

Source

Thrown at apps/api/plane/db/management/commands/reactivate_workspace_member.py:35

        parser.add_argument("slug", type=str, help="workspace slug")
        parser.add_argument("email", type=str, help="user email")

    def handle(self, *args, **options):
        # get the workspace slug and user email from console
        slug = options.get("slug") or ""
        email = options.get("email") or ""

        # normalize before validating; emails are stored lowercased and stripped (User.save)
        slug = slug.strip()
        email = email.strip().lower()

        # raise error if slug is not present
        if not slug:
            raise CommandError("Error: Workspace slug is required")

        # raise error if email is not present
        if not email:
            raise CommandError("Error: Email is required")

        # filter the user
        user = User.objects.filter(email=email).first()

        # Raise error if the user is not present
        if not user:
            raise CommandError(f"Error: User with {email} does not exist")

        # filter the workspace
        workspace = Workspace.objects.filter(slug=slug).first()

        # Raise error if the workspace is not present
        if not workspace:
            raise CommandError(f"Error: Workspace with slug {slug} does not exist")

        # Find the workspace membership (includes inactive members; soft-deleted are excluded by default manager)
        workspace_member = WorkspaceMember.objects.filter(workspace=workspace, member=user).first()

View on GitHub (pinned to 1c8a60f858)

Solutions

  1. Invoke via CLI: `python manage.py reactivate_workspace_member my-workspace user@example.com`.
  2. In wrappers, validate the email is non-empty before calling.
  3. Confirm the user exists (see [97]).

Example fix

# before
call_command('reactivate_workspace_member', slug='ws', email='')
# after
call_command('reactivate_workspace_member', slug='ws', email='user@example.com')
Defensive patterns

Strategy: validation

Validate before calling

import sys
email = ''  # from your script/env
if not email or not email.strip():
    sys.exit('email is required')

Type guard

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

Try / catch

try:
    call_command('reactivate_workspace_member', slug, email)
except CommandError as e:
    if 'Email is required' in str(e):
        # whitespace-only email passed programmatically
        ...

Prevention

When it happens

Trigger: Calling `call_command('reactivate_workspace_member', slug='ws', email=' ')`; otherwise argparse blocks missing positionals.

Common situations: Wrapper script passing a blank/whitespace email; misconfigured env var.

Related errors


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