{"record":{"id":"0bc4dc9cf894969e","repo":"makeplane/plane","slug":"project-not-found","errorCode":null,"errorMessage":"Project not found","messagePattern":"Project not found","errorType":"exception","errorClass":"CommandError","httpStatus":null,"severity":"error","filePath":"apps/api/plane/db/management/commands/create_project_member.py","lineNumber":48,"sourceCode":"            if not options[\"project_id\"]:\n                raise CommandError(\"Project ID is required\")\n            if not options[\"user_email\"]:\n                raise CommandError(\"User Email is required\")\n\n            project_id = options[\"project_id\"]\n            user_email = options[\"user_email\"]\n            role = options.get(\"role\", 20)\n\n            print(f\"Role: {role}\")\n\n            user = User.objects.filter(email=user_email).first()\n            if not user:\n                raise CommandError(\"User not found\")\n\n            # Check if the project exists\n            project = Project.objects.filter(pk=project_id).first()\n            if not project:\n                raise CommandError(\"Project not found\")\n\n            # Check if the user exists in the workspace\n            if not WorkspaceMember.objects.filter(workspace=project.workspace, member=user, is_active=True).exists():\n                raise CommandError(\"User not member in workspace\")\n\n\n            if ProjectMember.objects.filter(project=project, member=user).exists():\n                # Update the project member\n                ProjectMember.objects.filter(project=project, member=user).update(\n                    is_active=True, role=role\n                )\n            else:\n                # Create the project member\n                ProjectMember.objects.create(project=project, member=user, role=role)\n\n            # Issue Property\n            ProjectUserProperty.objects.get_or_create(user=user, project=project)\n","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/makeplane/plane/blob/1c8a60f858d8472aa56e29994ec1c7926da2c6ce/apps/api/plane/db/management/commands/create_project_member.py#L30-L66","documentation":"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`.","triggerScenarios":"Passing a non-existent, malformed, or wrong-type identifier as `--project_id` (e.g. project identifier string instead of UUID).","commonSituations":"Confusing project `identifier` (short code) with `id` (UUID); deleted project; copied id from the wrong field.","solutions":["Resolve the project UUID: `python manage.py shell -c \"from plane.db.models import Project; print(Project.objects.values_list('id','identifier','name'))\"`","Pass the exact UUID to `--project_id`.","Confirm the project is not archived/deleted."],"exampleFix":"# before\n--project_id PLANE          # using identifier, not pk\n# after\n--project_id 12345678-1234-1234-1234-1234567890ab","handlingStrategy":"validation","validationCode":"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)\"","typeGuard":"import uuid\ndef is_valid_project_uuid(value: str) -> bool:\n    try:\n        uuid.UUID(str(value))\n        return True\n    except (ValueError, AttributeError, TypeError):\n        return False","tryCatchPattern":"# Command swallows CommandError internally; pre-validate the project UUID.","preventionTips":["Use the project pk (UUID), not its identifier or name.","Resolve the UUID from the shell first.","Confirm the project is not deleted."],"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"}