makeplane/plane · error · CommandError

Project ID is required

Error message

Project ID is required

What it means

Raised by `create_project_member` when `--project_id` is not supplied or is falsy (line 30). Unlike positional args, `--project_id` is declared with `nargs="?"` (line 24), so argparse does NOT enforce its presence and the value defaults to `None`, making this check genuinely reachable. Note the command's `try/except CommandError` (lines 70-71) swallows it to an ERROR stdout line and returns 0.

Source

Thrown at apps/api/plane/db/management/commands/create_project_member.py:31

    ProjectMember,
    Project,
    ProjectUserProperty,
)


class Command(BaseCommand):
    help = "Add a member to a project. If present in the workspace"

    def add_arguments(self, parser):
        # Positional argument
        parser.add_argument("--project_id", type=str, nargs="?", help="Project ID")
        parser.add_argument("--user_email", type=str, nargs="?", help="User Email")
        parser.add_argument("--role", type=int, nargs="?", help="Role of the user in the project")

    def handle(self, *args: Any, **options: Any):
        try:
            if not options["project_id"]:
                raise CommandError("Project ID is required")
            if not options["user_email"]:
                raise CommandError("User Email is required")

            project_id = options["project_id"]
            user_email = options["user_email"]
            role = options.get("role", 20)

            print(f"Role: {role}")

            user = User.objects.filter(email=user_email).first()
            if not user:
                raise CommandError("User not found")

            # Check if the project exists
            project = Project.objects.filter(pk=project_id).first()
            if not project:
                raise CommandError("Project not found")

View on GitHub (pinned to 1c8a60f858)

Solutions

  1. Supply the UUID: `python manage.py create_project_member --project_id <uuid> --user_email <email>`
  2. Find the project id: `python manage.py shell -c "from plane.db.models import Project; print(Project.objects.values_list('id','name'))"`
  3. In wrapper scripts, guard with `if not project_id: sys.exit('project_id required')` before invoking.

Example fix

# before
python manage.py create_project_member --user_email x@example.com
# after
python manage.py create_project_member --project_id 12345678-1234-... --user_email x@example.com
Defensive patterns

Strategy: validation

Validate before calling

import sys
project_id = None  # from your script
if not project_id:
    sys.exit('--project_id is required')

Type guard

def has_project_id(value) -> bool:
    return isinstance(value, str) and len(value) > 0

Try / catch

# create_project_member swallows CommandError (returns 0), so the shell won't see it.
# Validate args before invoking instead.

Prevention

When it happens

Trigger: Running `python manage.py create_project_member --user_email x@example.com` without `--project_id`, or passing `--project_id ''`.

Common situations: Forgot the flag; copy-paste from docs that omitted the flag; script that conditionally omits the argument.

Related errors


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