Significant-Gravitas/AutoGPT · error · ValueError

Current user is not the org owner

Error message

Current user is not the org owner

What it means

Error "Current user is not the org owner" thrown in Significant-Gravitas/AutoGPT.

Source

Thrown at autogpt_platform/backend/backend/api/features/orgs/db.py:619

    # Remove org membership
    await prisma.orgmember.delete(
        where={"orgId_userId": {"orgId": org_id, "userId": user_id}}
    )


async def transfer_ownership(
    org_id: str, current_owner_id: str, new_owner_id: str
) -> None:
    """Transfer org ownership atomically. Both updates happen in one statement."""
    if current_owner_id == new_owner_id:
        raise ValueError("Cannot transfer ownership to the same user")

    current = await prisma.orgmember.find_unique(
        where={"orgId_userId": {"orgId": org_id, "userId": current_owner_id}}
    )
    if current is None or not current.isOwner:
        raise ValueError("Current user is not the org owner")

    new = await prisma.orgmember.find_unique(
        where={"orgId_userId": {"orgId": org_id, "userId": new_owner_id}}
    )
    if new is None:
        raise NotFoundError(f"User {new_owner_id} is not a member of org {org_id}")

    await prisma.execute_raw(
        """
        UPDATE "OrgMember"
        SET "isOwner" = CASE
                WHEN "userId" = $1 THEN false
                WHEN "userId" = $2 THEN true
                ELSE "isOwner"
            END,
            "isAdmin" = CASE
                WHEN "userId" = $2 THEN true
                ELSE "isAdmin"

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Only the current org owner can transfer ownership; sign in as the owner.
  2. Ask the current owner to perform the transfer.

When it happens

Trigger: Thrown at autogpt_platform/backend/backend/api/features/orgs/db.py:619 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14). Data as JSON: /api/errors/93cc9537389318c6. Report an issue: GitHub.