{"record":{"id":"71b717daabed548b","repo":"makeplane/plane","slug":"error-workspace-with-slug-slug-does-not-exist","errorCode":null,"errorMessage":"Error: Workspace with slug {slug} does not exist","messagePattern":"Error: Workspace with slug (.+?) does not exist","errorType":"console","errorClass":"CommandError","httpStatus":null,"severity":"error","filePath":"apps/api/plane/db/management/commands/reactivate_workspace_member.py","lineNumber":49,"sourceCode":"            raise CommandError(\"Error: Workspace slug is required\")\n\n        # raise error if email is not present\n        if not email:\n            raise CommandError(\"Error: Email is required\")\n\n        # filter the user\n        user = User.objects.filter(email=email).first()\n\n        # Raise error if the user is not present\n        if not user:\n            raise CommandError(f\"Error: User with {email} does not exist\")\n\n        # filter the workspace\n        workspace = Workspace.objects.filter(slug=slug).first()\n\n        # Raise error if the workspace is not present\n        if not workspace:\n            raise CommandError(f\"Error: Workspace with slug {slug} does not exist\")\n\n        # Find the workspace membership (includes inactive members; soft-deleted are excluded by default manager)\n        workspace_member = WorkspaceMember.objects.filter(workspace=workspace, member=user).first()\n\n        # Raise error if the membership is not present\n        if not workspace_member:\n            raise CommandError(f\"Error: User {email} is not a member of workspace {slug}\")\n\n        # If already active, report without erroring\n        if workspace_member.is_active:\n            self.stdout.write(self.style.SUCCESS(f\"User {email} is already an active member of workspace {slug}\"))\n            return\n\n        # Reactivate the membership. update_fields keeps the write to the columns that change, and\n        # disable_auto_set_user stops BaseModel.save from nulling created_by/updated_by when there\n        # is no request user, as is the case in a management command.\n        workspace_member.is_active = True\n        workspace_member.save(update_fields=[\"is_active\", \"updated_at\"], disable_auto_set_user=True)","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/makeplane/plane/blob/1c8a60f858d8472aa56e29994ec1c7926da2c6ce/apps/api/plane/db/management/commands/reactivate_workspace_member.py#L31-L67","documentation":"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.","triggerScenarios":"Passing a slug that does not exist or has trailing characters; wrong workspace.","commonSituations":"Typo in slug; workspace deleted; confused workspace name with slug.","solutions":["List slugs: `python manage.py shell -c \"from plane.db.models import Workspace; print(list(Workspace.objects.values_list('slug', flat=True)))\"`","Pass the exact slug (lowercase, hyphenated).","Confirm the workspace is not soft-deleted."],"exampleFix":"# before\npython manage.py reactivate_workspace_member MyWorkspace user@example.com   # name, not slug\n# after\npython manage.py reactivate_workspace_member my-workspace user@example.com","handlingStrategy":"validation","validationCode":"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)\"","typeGuard":"def workspace_exists(slug: str) -> bool:\n    from plane.db.models import Workspace\n    return Workspace.objects.filter(slug=slug.strip()).exists()","tryCatchPattern":"try:\n    call_command('reactivate_workspace_member', slug, email)\nexcept CommandError as e:\n    if 'Workspace with slug' in str(e):\n        # no such workspace — verify the slug\n        ...","preventionTips":["Pass the exact slug (lowercase, hyphenated), not the workspace name.","Confirm the workspace is not deleted.","Pre-check the slug exists before running."],"tags":["django","management-command","validation","not-found","plane"],"backgroundTag":null,"analyzedSha":"1c8a60f858d8472aa56e29994ec1c7926da2c6ce","analyzedAt":"2026-08-12T14:44:31.636Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}