{"record":{"id":"937edb6b92448312","repo":"Significant-Gravitas/AutoGPT","slug":"organization-is-already-a-team-org","errorCode":null,"errorMessage":"Organization is already a team org","messagePattern":"Organization is already a team org","errorType":"http","errorClass":"ValueError","httpStatus":400,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/orgs/db.py","lineNumber":423,"sourceCode":"        where={\"id\": org_id},\n        data={\"deletedAt\": datetime.now(timezone.utc)},\n    )\n\n\nasync def convert_personal_org(org_id: str, user_id: str) -> OrgResponse:\n    \"\"\"Convert a personal org to a team org.\n\n    Creates a new personal org for the user so they always have one.\n    Existing resources (agents, credits, store listings) stay in the\n    team org — that's the point of converting.\n\n    If new personal org creation fails, the conversion is rolled back.\n    \"\"\"\n    org = await prisma.organization.find_unique(where={\"id\": org_id})\n    if org is None:\n        raise NotFoundError(f\"Organization {org_id} not found\")\n    if not org.isPersonal:\n        raise ValueError(\"Organization is already a team org\")\n\n    # Step 1: Flip isPersonal on the old org\n    await prisma.organization.update(\n        where={\"id\": org_id},\n        data={\"isPersonal\": False},\n    )\n\n    # Step 2: Create a new personal org for the user\n    try:\n        slug_base = f\"{_sanitize_slug(org.slug)}-personal-1\"\n        # Fetch user name for display\n        user = await prisma.user.find_unique(where={\"id\": user_id})\n        display_name = user.name if user and user.name else org.name\n\n        await _create_personal_org_for_user(\n            user_id=user_id,\n            slug_base=slug_base,\n            display_name=display_name,","sourceCodeStart":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/orgs/db.py#L405-L441","documentation":"Error \"Organization is already a team org\" thrown in Significant-Gravitas/AutoGPT.","triggerScenarios":"Thrown at autogpt_platform/backend/backend/api/features/orgs/db.py:423 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["No action needed; the organization is already a team org.","Refresh the organization state before retrying the conversion."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}