makeplane/plane · error · CommandError

Error: User {email} is not a member of workspace {slug}

Error message

Error: User {email} is not a member of workspace {slug}

What it means

Raised by `reactivate_workspace_member` when no `WorkspaceMember` row links the (existing) user and (existing) workspace (lines 52-56). The membership was never created, or it was hard-deleted. Note the default manager excludes soft-deleted rows, so a soft-deleted membership would also surface here. This differs from an INACTIVE membership (`is_active=False`), which IS found here and then reactivated — so this error specifically means no row at all. Clean non-zero CommandError.

Source

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

        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)

        self.stdout.write(
            self.style.SUCCESS(
                f"User {email} reactivated successfully in workspace {slug} as {workspace_member.get_role_display()}"
            )
        )

View on GitHub (pinned to 1c8a60f858)

Solutions

  1. Check including soft-deleted: `WorkspaceMember.all_objects.filter(workspace=..., member=...)` to see if a soft-deleted row exists.
  2. If truly no membership, add the user to the workspace through the normal invite flow (UI or `WorkspaceMember.objects.create(...)`).
  3. Confirm you paired the correct slug with the correct email.

Example fix

# before — no WorkspaceMember row exists, so reactivation cannot work
python manage.py reactivate_workspace_member my-ws user@example.com
# after — re-invite the user to the workspace first (creates the membership),
# then deactivate/reactivate as needed
python manage.py shell -c "from plane.db.models import Workspace, User, WorkspaceMember; ws=Workspace.objects.get(slug='my-ws'); u=User.objects.get(email='user@example.com'); WorkspaceMember.objects.create(workspace=ws, member=u, role=20, is_active=True)"
Defensive patterns

Strategy: validation

Validate before calling

python manage.py shell -c "from plane.db.models import WorkspaceMember; import sys; sys.exit(0 if WorkspaceMember.objects.filter(workspace__slug='my-ws', member__email='user@example.com').exists() else 1)"

Type guard

def membership_exists(slug: str, email: str) -> bool:
    from plane.db.models import WorkspaceMember
    return WorkspaceMember.objects.filter(workspace__slug=slug, member__email=email).exists()

Try / catch

try:
    call_command('reactivate_workspace_member', slug, email)
except CommandError as e:
    if 'is not a member' in str(e):
        # no membership row — re-invite the user to the workspace first
        ...

Prevention

When it happens

Trigger: The user exists and the workspace exists, but the user was never a member, or their membership row was hard-deleted rather than deactivated.

Common situations: User was removed via a path that deleted the row; attempting to reactivate someone who was only ever invited but never joined; wrong user/workspace pairing.

Related errors


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