makeplane/plane · error · CommandError

Error: Workspace with slug {slug} does not exist

Error message

Error: Workspace with slug {slug} does not exist

What it means

Raised by `reactivate_workspace_member` when `Workspace.objects.filter(slug=slug).first()` returns None (lines 45-49). No workspace with the given slug exists. The slug is `.strip()`-ed but not transformed, so it must match exactly (slugs are typically lowercased kebab strings). Clean non-zero CommandError.

Source

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

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

        # Raise error if the membership is not present
        if not workspace_member:
            raise CommandError(f"Error: User {email} is not a member of workspace {slug}")

        # If already active, report without erroring
        if workspace_member.is_active:
            self.stdout.write(self.style.SUCCESS(f"User {email} is already an active member of workspace {slug}"))
            return

        # Reactivate the membership. update_fields keeps the write to the columns that change, and
        # disable_auto_set_user stops BaseModel.save from nulling created_by/updated_by when there
        # is no request user, as is the case in a management command.
        workspace_member.is_active = True
        workspace_member.save(update_fields=["is_active", "updated_at"], disable_auto_set_user=True)

View on GitHub (pinned to 1c8a60f858)

Solutions

  1. List slugs: `python manage.py shell -c "from plane.db.models import Workspace; print(list(Workspace.objects.values_list('slug', flat=True)))"`
  2. Pass the exact slug (lowercase, hyphenated).
  3. Confirm the workspace is not soft-deleted.

Example fix

# before
python manage.py reactivate_workspace_member MyWorkspace user@example.com   # name, not slug
# after
python manage.py reactivate_workspace_member my-workspace user@example.com
Defensive patterns

Strategy: validation

Validate before calling

python manage.py shell -c "from plane.db.models import Workspace; import sys; sys.exit(0 if Workspace.objects.filter(slug='my-workspace').exists() else 1)"

Type guard

def workspace_exists(slug: str) -> bool:
    from plane.db.models import Workspace
    return Workspace.objects.filter(slug=slug.strip()).exists()

Try / catch

try:
    call_command('reactivate_workspace_member', slug, email)
except CommandError as e:
    if 'Workspace with slug' in str(e):
        # no such workspace — verify the slug
        ...

Prevention

When it happens

Trigger: Passing a slug that does not exist or has trailing characters; wrong workspace.

Common situations: Typo in slug; workspace deleted; confused workspace name with slug.

Related errors


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