makeplane/plane · error · CommandError

Error: Workspace slug is required

Error message

Error: Workspace slug is required

What it means

Raised by `reactivate_workspace_member` when `slug` is empty after `.strip()` (lines 26-31). Because `slug` is a required positional argument (line 17), argparse rejects a missing value first, so this branch is only reachable programmatically (e.g. passing a whitespace-only string). This command has no try/except wrapper, so it is a clean non-zero CommandError. Note the message keeps the 'Error: ' prefix inline.

Source

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

    help = "Reactivate a workspace member given a workspace slug and user email"

    def add_arguments(self, parser):
        # Positional arguments
        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")

View on GitHub (pinned to 1c8a60f858)

Solutions

  1. Invoke via CLI with the slug: `python manage.py reactivate_workspace_member my-workspace user@example.com`.
  2. In wrappers, validate and strip the slug before calling.
  3. Confirm the slug with `Workspace.objects.filter(slug=...).exists()`.

Example fix

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

Strategy: validation

Validate before calling

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

Type guard

def is_non_empty_slug(value: str) -> bool:
    return isinstance(value, str) and bool(value.strip())

Try / catch

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

Prevention

When it happens

Trigger: Calling `call_command('reactivate_workspace_member', slug=' ', email='x@y.com')` (whitespace slug); otherwise argparse blocks a missing positional.

Common situations: Wrapper scripts passing a whitespace/empty slug; env var that resolved to blank.

Related errors


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