{"record":{"id":"761a3745a8fce0e8","repo":"makeplane/plane","slug":"user-email-is-required-and-should-have-signed-in-p","errorCode":null,"errorMessage":"User email is required and should have signed in plane","messagePattern":"User email is required and should have signed in plane","errorType":"exception","errorClass":"CommandError","httpStatus":null,"severity":"error","filePath":"apps/api/plane/db/management/commands/create_dummy_data.py","lineNumber":30,"sourceCode":"\nclass Command(BaseCommand):\n    help = \"Create dump issues, cycles etc. for a project in a given workspace\"\n\n    def handle(self, *args: Any, **options: Any) -> str | None:\n        try:\n            workspace_name = input(\"Workspace Name: \")\n            workspace_slug = input(\"Workspace slug: \")\n\n            if workspace_slug == \"\":\n                raise CommandError(\"Workspace slug is required\")\n\n            if Workspace.objects.filter(slug=workspace_slug).exists():\n                raise CommandError(\"Workspace already exists\")\n\n            creator = input(\"Your email: \")\n\n            if creator == \"\" or not User.objects.filter(email=creator).exists():\n                raise CommandError(\"User email is required and should have signed in plane\")\n\n            user = User.objects.get(email=creator)\n\n            members = input(\"Enter Member emails (comma separated): \")\n            members = members.split(\",\") if members != \"\" else []\n            # Create workspace\n            workspace = Workspace.objects.create(slug=workspace_slug, name=workspace_name, owner=user)\n            # Create workspace member\n            WorkspaceMember.objects.create(workspace=workspace, role=20, member=user)\n            user_ids = User.objects.filter(email__in=members)\n\n            _ = WorkspaceMember.objects.bulk_create(\n                [WorkspaceMember(workspace=workspace, member=user_id, role=20) for user_id in user_ids],\n                ignore_conflicts=True,\n            )\n\n            project_count = int(input(\"Number of projects to be created: \"))\n","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/makeplane/plane/blob/1c8a60f858d8472aa56e29994ec1c7926da2c6ce/apps/api/plane/db/management/commands/create_dummy_data.py#L12-L48","documentation":"Raised by the interactive `create_dummy_data` management command when the value typed at the 'Your email:' prompt is empty OR does not match any row in the `User` table (line 29: `creator == \"\" or not User.objects.filter(email=creator).exists()`). The command needs an existing, signed-in Plane user to become the workspace owner and first member, so it aborts. Because the whole handler is wrapped in `except Exception` (lines 72-74), the CommandError is actually caught and printed via `self.style.ERROR` then the command returns 0 rather than exiting non-zero.","triggerScenarios":"Running `python manage.py create_dummy_data` and (a) pressing Enter on an empty email, or (b) typing an email for a user who never signed in / has no `User` row.","commonSituations":"Freshly seeded DB with no users yet; user registered but with different email casing (User.save lowercases); typo at the prompt; running before the intended owner has completed first sign-in.","solutions":["Confirm the user row exists: `python manage.py shell -c \"from plane.db.models import User; print(User.objects.filter(email='you@example.com').exists())\"`","Have the user sign in through the web UI once so the `User` record is created, then re-run the command.","Re-type the exact stored email (lower-cased) at the 'Your email:' prompt."],"exampleFix":"# before\ncreator = input(\"Your email: \")   # typed '' or wrong email\n# after\ncreator = input(\"Your email: \")   # enter the exact lowercased email of an existing User","handlingStrategy":"validation","validationCode":"# Pre-flight: ensure the owner user exists before running the command\npython manage.py shell -c \"from plane.db.models import User; import sys; sys.exit(0 if User.objects.filter(email='owner@example.com').exists() else 1)\"","typeGuard":"def is_existing_plane_user(email: str) -> bool:\n    from plane.db.models import User\n    return bool(email) and User.objects.filter(email=email).exists()","tryCatchPattern":"# create_dummy_data swallows CommandError internally (returns 0), so a shell-level\n# try/catch will NOT see it. Validate inputs beforehand instead.","preventionTips":["Require the owner to sign in once before running dummy-data seeding.","Lowercase the email before typing it at the prompt.","Pre-check User.objects.filter(email=...).exists() in a wrapper script."],"tags":["django","management-command","validation","input-validation","plane","interactive"],"backgroundTag":null,"analyzedSha":"1c8a60f858d8472aa56e29994ec1c7926da2c6ce","analyzedAt":"2026-08-12T14:44:31.636Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}