{"record":{"id":"a611dae8c22387f7","repo":"Significant-Gravitas/AutoGPT","slug":"cannot-delete-a-personal-organization-convert-it","errorCode":null,"errorMessage":"Cannot delete a personal organization. Convert it first.","messagePattern":"Cannot delete a personal organization\\. Convert it first\\.","errorType":"http","errorClass":"ValueError","httpStatus":400,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/orgs/db.py","lineNumber":400,"sourceCode":"    if profile_update:\n        await prisma.organizationprofile.update(\n            where={\"organizationId\": org_id},\n            data=profile_update,\n        )\n\n    return await get_org(org_id)\n\n\nasync def delete_org(org_id: str) -> None:\n    \"\"\"Soft-delete an organization. Cannot delete personal orgs.\n\n    Sets deletedAt instead of hard-deleting to preserve financial records.\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 org.isPersonal:\n        raise ValueError(\"Cannot delete a personal organization. Convert it first.\")\n    if org.deletedAt is not None:\n        raise ValueError(\"Organization is already deleted\")\n\n    await prisma.organization.update(\n        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    \"\"\"","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/orgs/db.py#L382-L418","documentation":"Error \"Cannot delete a personal organization. Convert it first.\" thrown in Significant-Gravitas/AutoGPT.","triggerScenarios":"Thrown at autogpt_platform/backend/backend/api/features/orgs/db.py:400 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Convert the personal organization to a team organization before deleting it.","Keep the personal organization if you still need an account."],"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"}