makeplane/plane · error · CommandError

Project not found

Error message

Project not found

What it means

Raised by `create_project_member` when `Project.objects.filter(pk=project_id).first()` returns None (lines 46-48). No project exists with the given primary key. The lookup is by `pk`, so the value must be the project's UUID, not its identifier or name. Swallowed by the command's `except CommandError`.

Source

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

            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")

            # Check if the user exists in the workspace
            if not WorkspaceMember.objects.filter(workspace=project.workspace, member=user, is_active=True).exists():
                raise CommandError("User not member in workspace")


            if ProjectMember.objects.filter(project=project, member=user).exists():
                # Update the project member
                ProjectMember.objects.filter(project=project, member=user).update(
                    is_active=True, role=role
                )
            else:
                # Create the project member
                ProjectMember.objects.create(project=project, member=user, role=role)

            # Issue Property
            ProjectUserProperty.objects.get_or_create(user=user, project=project)

View on GitHub (pinned to 1c8a60f858)

Solutions

  1. Resolve the project UUID: `python manage.py shell -c "from plane.db.models import Project; print(Project.objects.values_list('id','identifier','name'))"`
  2. Pass the exact UUID to `--project_id`.
  3. Confirm the project is not archived/deleted.

Example fix

# before
--project_id PLANE          # using identifier, not pk
# after
--project_id 12345678-1234-1234-1234-1234567890ab
Defensive patterns

Strategy: validation

Validate before calling

python manage.py shell -c "from plane.db.models import Project; import sys; sys.exit(0 if Project.objects.filter(pk='<uuid>').exists() else 1)"

Type guard

import uuid
def is_valid_project_uuid(value: str) -> bool:
    try:
        uuid.UUID(str(value))
        return True
    except (ValueError, AttributeError, TypeError):
        return False

Try / catch

# Command swallows CommandError internally; pre-validate the project UUID.

Prevention

When it happens

Trigger: Passing a non-existent, malformed, or wrong-type identifier as `--project_id` (e.g. project identifier string instead of UUID).

Common situations: Confusing project `identifier` (short code) with `id` (UUID); deleted project; copied id from the wrong field.

Related errors


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