{"record":{"id":"71652d426fbbb972","repo":"makeplane/plane","slug":"error-workspace-slug-is-required","errorCode":null,"errorMessage":"Error: Workspace slug is required","messagePattern":"Error: Workspace slug is required","errorType":"exception","errorClass":"CommandError","httpStatus":null,"severity":"error","filePath":"apps/api/plane/db/management/commands/reactivate_workspace_member.py","lineNumber":31,"sourceCode":"    help = \"Reactivate a workspace member given a workspace slug and user email\"\n\n    def add_arguments(self, parser):\n        # Positional arguments\n        parser.add_argument(\"slug\", type=str, help=\"workspace slug\")\n        parser.add_argument(\"email\", type=str, help=\"user email\")\n\n    def handle(self, *args, **options):\n        # get the workspace slug and user email from console\n        slug = options.get(\"slug\") or \"\"\n        email = options.get(\"email\") or \"\"\n\n        # normalize before validating; emails are stored lowercased and stripped (User.save)\n        slug = slug.strip()\n        email = email.strip().lower()\n\n        # raise error if slug is not present\n        if not slug:\n            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\")","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/makeplane/plane/blob/1c8a60f858d8472aa56e29994ec1c7926da2c6ce/apps/api/plane/db/management/commands/reactivate_workspace_member.py#L13-L49","documentation":"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.","triggerScenarios":"Calling `call_command('reactivate_workspace_member', slug='   ', email='x@y.com')` (whitespace slug); otherwise argparse blocks a missing positional.","commonSituations":"Wrapper scripts passing a whitespace/empty slug; env var that resolved to blank.","solutions":["Invoke via CLI with the slug: `python manage.py reactivate_workspace_member my-workspace user@example.com`.","In wrappers, validate and strip the slug before calling.","Confirm the slug with `Workspace.objects.filter(slug=...).exists()`."],"exampleFix":"# before\ncall_command('reactivate_workspace_member', slug='   ', email='user@example.com')\n# after\ncall_command('reactivate_workspace_member', slug='my-workspace', email='user@example.com')","handlingStrategy":"validation","validationCode":"import sys\nslug = '   '  # from your script/env\nif not slug or not slug.strip():\n    sys.exit('slug is required')","typeGuard":"def is_non_empty_slug(value: str) -> bool:\n    return isinstance(value, str) and bool(value.strip())","tryCatchPattern":"try:\n    call_command('reactivate_workspace_member', slug, email)\nexcept CommandError as e:\n    if 'Workspace slug is required' in str(e):\n        # whitespace-only slug passed programmatically\n        ...","preventionTips":["Invoke via CLI so argparse enforces the positional.","Strip and validate the slug in wrapper scripts.","Confirm the slug exists before running."],"tags":["django","management-command","validation","argparse","plane"],"backgroundTag":null,"analyzedSha":"1c8a60f858d8472aa56e29994ec1c7926da2c6ce","analyzedAt":"2026-08-12T14:44:31.636Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}